Questions tagged [halide]
For question related to the Halide domain-specific language including scheduling, and computations. Halide supports different languages such as C, C++, Matlab/octave and Python. Please consider a language tag as well.
248
questions
0
votes
1
answer
31
views
halide generator has green image when compiled on gpu
When compiling halide generator for gpu target CUDA I get green image (on cpu image is correct).
Here is the algorithm:
output(c,x,y) = Halide::cast<uint8_t> (input(mux(c, {1,0,2,3,0,2}),...
1
vote
0
answers
60
views
Inlining a rvar to a var stage in Halide
I’m trying to inline a rvar to a regular var stage.
Let’s say I have an input vector of some size, which I would like to multiply each element by 2, as well as sum all of its elements.
something like :...
0
votes
1
answer
42
views
input buffer of type Halide::Runtime::Buffer gets modified by generator
I have a generator that has input and output:
Input<Buffer<uint8_t>> input{"input", 2};
Output<Buffer<uint8_t>> output{"output", 2};
In generate method I ...
1
vote
1
answer
70
views
Do you need to free the buffer pointer passed to Halide
If I create a Halide::Buffer by constructing it with a pointer from an STB_Image function call like so:
inline Halide::Buffer<uint8_t> LoadFromFile(const char* filename)
{
int w, h, d;
...
0
votes
0
answers
27
views
Is Halide possible for debugging in AOT (ahead of time) compilation?
I am wondering is Halide even possible for debugging in AOT compilation? I saw the Halide tutorials but it seems debugging like print, print_when is only possible under JIT compilation. I am now ...
0
votes
1
answer
21
views
Halide function failing with an error `Input buffer b0 is accessed at 2, which is beyond the max (-1) in dimension 2`
I'm converting COCO2017 dataset to RAW Bayer format using Approx-Vision library. It works just fine for most of the images, but fails for other images.
I am using pipeline_V2.cpp which is run by this ...
1
vote
0
answers
28
views
how to realize a 3-level cached with Halide
I hope to use halide to simulate a three-level cache architecture for cpu. and the memory size is divided by each top layer. such as
(256*256) -> 16 * (16*256) -> 16 * 4 * (4*256) -> 16 * (...
0
votes
1
answer
70
views
translating pixel unpacking to halide algorithm
I have a buffer filled with pixel data in pattern UY1VY2... and I want to unpack that to another buffer in pattern Y1UVY2UV... So basically if I had a vector of that data I want following operation
...
0
votes
1
answer
53
views
Ramp of lanes <= 1 exception when cross-compile Halide for RISC-V
Tried this tutorial https://halide-lang.org/tutorials/tutorial_lesson_11_cross_compilation.html on x86 host machine (Ubuntu 20.04) but for RISC-V target architecture. Unfortunately, there is an ...
1
vote
1
answer
70
views
Different expressions for different outputs in Halide
I'm new to Halide so also kinda didn't know how to ask the question. Let me explain. Let's assume I have a simple code for Halide's generator like this:
class Blur : public Generator<Blur>{
...
0
votes
1
answer
28
views
Does Adams and Mullapudi autoschedulers support specializations?
The Adams and Mullapudi autoschedulers often generate schedules which include the vectorize and split primitives with constant parameters on them. These schedules do not work for all array sizes fed ...
2
votes
1
answer
45
views
Express time-step loops in Halide
I am trying to implement the following loop nest in Halide
for (t = 0; t < TSTEPS; t++)
for (i = 1; i < N - 1; i++)
A[i] = (A[i-1] + A[i] + A[i + 1])/3;
But I couldn't figure out how to ...
0
votes
1
answer
37
views
Including ComplexExpr and ComplexFunc classes in Halide API
The ComplexExpr and ComplexFunc classes in the links below seem very convenient to work with complex numbers. Is there a plan to include them into the official Halide API? Or is there a reason why ...
0
votes
0
answers
37
views
Non-associative RDOM parallellization in Halide
I am trying to write a decoder for GPU. My encoding scheme has data dependencies between lines. So when decoding columns of data each column depends on the previous. I want to parallellize the ...
0
votes
1
answer
133
views
Cannot find libHalide.so to build
I'd like to build the Halide tutorials on mac.
The instruction says:
// On os x:
// g++ lesson_02*.cpp -g -I <path/to/Halide.h> -I <path/to/tools/halide_image_io.h> -L <path/to/...
0
votes
0
answers
145
views
How to convert Halide::Buffer<unsigned char> to c++ array
In lesson_02_input_image.cpp, I am trying to transpose Buffer<uint8_t> type data to a c++ array so that compare the time consumption between halide and c++. The code is like :
Halide::Buffer<...
1
vote
0
answers
71
views
Halide Error: Input buffer b0 is accessed at -1, which is before the min (0) in dimension 0 - sobel edge detector
I'm trying to develop a sobel edge detector using Halide.
Because I need to compute the 3x3 square around each pixel, I'm trying to realize the function over a smaller rectangle (and avoid the outer ...
1
vote
1
answer
156
views
How to derive a class that is already derived from Halide::Generator?
I would like to create a basic inheritance structure based on Halide::Generator in Halide/C++, so as to avoid duplicated code.
The idea is to have an abstract base generator class that owns a pure ...
0
votes
1
answer
221
views
Linker gives undefined symbols error when cross compiling Halide
Hey I'm trying to build Halide into static library for arm64-v8a Android architecture on the host OSX system. When I run the following commands I get the linking errors below. Which part am I doing ...
0
votes
1
answer
262
views
How to calculate maximum/minimum over n-channels in Halide using domains?
I am currently trying out Halide, playing around with calculating the maximum/minimum over all channels of an image. I would like to achieve this for a arbitrary images, where the amount of channels ...
1
vote
1
answer
150
views
How to calculate chroma image in Halide?
I am currently evaluating if Halide is a good choice for my programmes. As a short Hello Halide example, I wanted to convert an rgb image to hsl space. However, when trying, I got stuck at the first ...
2
votes
2
answers
394
views
HEXAGON Halide Tools 2.3: /usr/bin/ld: cannot find -lc++abi
I did not get response from Qualcomm forum so I decided to post here. When I was trying to run examples of Halide for Hexagon by running make run as written in the document. Then I got the following ...
0
votes
1
answer
176
views
How to load_image() in Halide with 4 channels instead of 3?
I want to get a 4 channel image instead of 3 while loading it in Halide, however load_image() gives only 3 channel images. How can I solve it?
0
votes
2
answers
235
views
CMake for Halide Hexagon failed while successfully compiled using g++
I am writing CMake file for the following command:
g++ --std=c++11 -DLOG2VLEN=7 -DRUN=1 -DASSEMBLY=1 -DBITCODE=1 -I
/home/user/Qualcomm/HALIDE_Tools/2.2.06/Halide/include -fno-rtti -O3 -g
...
0
votes
1
answer
94
views
Halide: image shifts to top-left after convolution using a large patch
I encounter a strange issue during convolution using Halide. Below is the code
Func Deblur::filter2D(Func ima, Func ker, RDom r) {
Func blur{"blur1"};
blur(x, y, c) += ker(r.x, r.y) ...
0
votes
1
answer
73
views
Why is the extern func called multiple times?
Recently, I tried using the defin_extern method defined by Halide with AOT mode.
The description code of the Halide frontend is as follows:
class ExternFuncInput : public Generator<ExternFuncInput&...
3
votes
0
answers
146
views
Efficient Image Normalization in Halide
I've discover Halide (the language), a few weeks ago and I actually enjoy trying to optimize some parts of my code with it, nonetheless, I struggle to find an optimized implementation of a very basic ...
1
vote
1
answer
93
views
Is there a Halide::BoundaryConditions to mimic OpenCV default border type?
The documentation says this is similar to GL_MIRRORED_REPEAT. I tried to research this, but it doesn't seem as specific as the OpenCV border types.
BORDER_REFLECT_101 as gfedcb|abcdefgh|gfedcba, ...
0
votes
1
answer
172
views
Halide - sort buffer/function in one dimension
I am currently using Halide with the use of a generator and ahead of time compilation.
Somewhere in the pipeline I have a 3D buffer with limited extent (typically 3-6 values) in one of the dimensions.
...
0
votes
0
answers
114
views
Sorting a list of tuple according to integer value of on of the tuple members
I have Halide func which is iterating over a gray image and finding highest gray value in 3x3 patch. I am using RDOM to search for largest gray value in 3x3 patch, which returns a Tuple of the X,Y ...
3
votes
0
answers
392
views
How to prevent Halide 'select' from evaluating both branches
The select expression in Halide is similar to if or switch statement in C. That is to say, the expression select(cond, a, b) will evaluate to a if cond is true, otherwise it evaluates to b.
So, I ...
0
votes
1
answer
57
views
how to use define_extern in Halide with JIT?
when i compile the "extern_stage.cpp" in Halide/test/correctness/extern_stage.cpp, cmd as follow:
g++ extern_stage.cpp -g -I ../../../Halide/build/include/ -L ../../../Halide/bin -lHalide -...
1
vote
1
answer
266
views
Issues setting stride in Halide python bindings (Error: Constraint violated: brighten.stride.0 (1) == 3 (3))
I'm trying to use a C memory layout (RGBRGBRGBRGB) instead of planar from an AOT compiled halide function (build and run with the python bindings.) Following the C++ tutorial here, I set the stride ...
1
vote
1
answer
219
views
Halide non-contiguous memory layout
Is it possible to use non-c/fortran ordering in Halide? (where given dimensions x, y, c, x varies the fastest, then c varies the 2nd fastest (strides in numpy at least would be: .strides = (W*C, 1, W) ...
1
vote
1
answer
437
views
Sum of array in Halide
I've started learning Halide. Suppose I wanted to calculate the sum of elements in an array. Why is the following code snippet failing?
constexpr int N = 10;
ImageParam array(Float(32), 1);
Var x;
...
1
vote
1
answer
308
views
When trying to build Halide on Linux system with llvm-10.0 on release/10.x and master branches, facing the below issue
[ 53%] Linking CXX executable test_function_dag
/bin/ld: ../../libHalide.so.10.0.0: undefined reference to `typeinfo for llvm::SectionMemoryManager'
collect2: error: ld returned 1 exit status
make[2]: ...
1
vote
1
answer
153
views
How to solve Halide Constraint violation problem (in Python)
Can anyone help?
I've implemented a halide aot function in python to compute a histogram of a grayscale image... I create a numpy array to hold the histogram like so:
histo = np.empty((1, 2048), dtype=...
0
votes
1
answer
135
views
How do I keep passing the output of a Halide pipeline back into the pipeline until some condition is met?
I have a Halide pipeline which takes in an image, and applies some filters to it. It works fine for a single pass. I pass in an image, and I get the processed image as the output. What I would like to ...
0
votes
1
answer
226
views
Halide JIT vs Generator Differences
While playing around with Halide, I see that totally different pseudocodes are created for a same pipline when using JIT and a generated function approaches. It looks like I'm missing something and so ...
0
votes
1
answer
113
views
Is there a way to specifiy a Halide computation that operates on quartets of pixels?
In Halide, is there a way to split up an input image into 2x2 quartets of pixels and implement a unique computation in each pixel of the quartet?
For example, I want to implement the following ...
0
votes
1
answer
139
views
How to build a windows static library for lesson15 under windows platform?
I have successful built the LLVM and Halide with Visual studio 2019 on windows platform.
I then tried to make some no_runtime objs and a halide_runtime obj and link them together.
./lesson_15_generate ...
0
votes
1
answer
153
views
How do I use declare a halide Func with float16_t?
let say I want to perform a running horizontal average on x-axis of an image.
Func g;
g(x,y) = (img(x-1,y) + img(x,y) + img(x+1,y))/3.f;
h(x,y) = cast<uint8_t>(g(x,y) + 0.5f);
Using float32 for ...
0
votes
1
answer
276
views
Halide process average of color image
I am starting to learn Halide. What I want to do is apply a filter based on the average value of an RGB image. Essentially, I am trimming the highlights and the lows for further processing. I need the ...
1
vote
1
answer
105
views
how do I dispatch the functions that generated by halide (tutorial lesson 15)?
The tutorial generates 3 functions with different target and pack into a single static library along with halide runtime.
The question is, how do I call it ?
To my understanding, I should check the ...
0
votes
1
answer
173
views
How to debug Halide internal error with CodeGen_LLVM
I have problems finding the source of an error message reported by JIT-compiled pipeline with halide.
The log message is:
Internal Error at Halide-release_2019_08_27/halide/src/CodeGen_LLVM.cpp:2815 ...
1
vote
1
answer
342
views
How do I switch auto-scheduler of "lesson 21: Auto-Scheduler" to Adam2019 or Li2018
I believe that the auto-scheduler adopted in lesson_21_auto_scheduler_generate.cpp is a classical Mullapudi2016 algorithm.
How do I switch this auto-scheduler to Adam2019 or Li2018 for this lesson ?
...
1
vote
1
answer
120
views
Speed up compilation and bench-marking of schedules
I am making a program that is bench-marking a lot of generated schedules for a particular algorithm. But that is taking a lot of time, for the most part due to the compilation of each schedule. And I ...
0
votes
1
answer
158
views
Buffer Argument is NULL
I am new to Halide and was given a image processing Pipeline. I am trying to understand this pipe line by printing values. Following the tutorial from https://halide-lang.org/tutorials/...
0
votes
1
answer
161
views
how to free a CPU buffer defined in halide
my projec used the buffer both in GPU and CPU.
code are similar like this:
xxx = HalideBuffer_n(width, heght, 1); // buffer in CPU
xxx.device_malloc(device); // buffer in GPU
PS: using ...
1
vote
1
answer
212
views
Halide with GPU schedule produce black image
I'm trying to learn Halide and I can't get GPU right, because it generate black images when scheduled for GPU. For CPU it produce good result (when comment out brighter.gpu_tile(x, y, xo, yo, xi, yi, ...