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.

Overview

Halide is an open-source domain-specific language which allows flexibility in iterating over dimensions to apply computations.

There are two basic parts to Halide code. One describes the computations and the second is the schedule. The schedule allows trade-offs between redundant computations, cache locality and parallelism as the computations iterate over the data space.

Halide is principally used for image processing and computational photography, but it can be applied to audio, encryption, machine vision, and physical simulation. In some ways, Halide is an aspect oriented framework; it separates the description of the algorithm from the definition of how that algorithm is to be implemented via a schedule.

Halide is embedded within C++ and uses the LLVM plug-in mechanics to generate code. Two modes are supported:

  1. JIT (just in time) - in this mode, the code is created at run time. The generated code is available to be called. The Halide code consists of templates and classes which may be updated at runtime. This mode is very flexible for iterating over different design choices.
  2. AOT (ahead of time) - this is like a more traditional compilation mode. Two executeables are built. One is a generator which creates an object file with several functions. The object file take parameters (buffers, etc) and produces outputs (buffers, constants). The generates object can be linked to many languages that are ABI compliant, such as even thought the primary language used to code Halide is C++.

It can be helpful to specify which mode you are targeting when asking questions.

Resources/References

The Halide tutorials give a gentle introduction to topics and concepts related to the framework.

More information can be found on the website: http://halide-lang.org

Much of the information here is taken from a CppCon 2020 video by Alex Reinking.

253 questions
0
votes
1 answer

How to get a halide buffer with data on GPU?

I'm new to halide. Now I have a pointer which points to data on GPU. I want to get a halide buffer from this pointer without copying data. I have searched a lot and found this /halidebuffer-on-gpu . It says using Buffer::device_wrap_native will be…
111qqz
  • 11
  • 1
0
votes
1 answer

Error: Input buffer filter is accessed at 63, which is beyond the max (15) in dimension 2 Aborted (core dumped)

I want to test my algorithm written in halide on tiramisu compiler once i run it i got an error like this one Error: Input buffer filter is accessed at 63, which is beyond the max (15) in dimension 2 Aborted (core dumped) So i decided to only test…
DINA TAKLIT
  • 7,074
  • 10
  • 69
  • 74
0
votes
1 answer

llvm Linking CXX shared library ../../lib/libLTO.so undefiened refernece to target

i tried to install tiramisu compiler and once trying install it's sub-modules ( (ISL, LLVM and Halide) by using this command dina@dina-VBox:~/tiramisu$ ./utils/scripts/install_submodules.sh ./ i get the error Done installing isl #### Installing…
DINA TAKLIT
  • 7,074
  • 10
  • 69
  • 74
0
votes
2 answers

get Tiramisu submodules llvm for Halide failed with .//3rdParty/llvm: No such file or directory error

Hi i'm trying to install tiramisu compiler. and once trying install it's sub-modules ( (ISL, LLVM and Halide) by using this command dina@dina-VBox:~/tiramisu$ ./utils/scripts/install_submodules.sh ./ and i get in the end this error Done installing…
DINA TAKLIT
  • 7,074
  • 10
  • 69
  • 74
0
votes
1 answer

Halide multi-GPU support

I have a multi-staged pipeline in a Halide::Generator that is scheduled to run on a GPU. On my computer, I have two CUDA enabled GPUs, and I would like to know whether it's possible to run two instances of this generator in parallel (one on each of…
zanbri
  • 5,958
  • 2
  • 31
  • 41
0
votes
2 answers

How to Generate Halide Function with float argument

I'm trying to create a (C++) helper function that transforms a lookup table that's computed in my C++ code into a Halide Func which takes a float as an argument and lerps between samples in the LUT. The use-case here is that the user has generated a…
j4m3z0r
  • 397
  • 1
  • 3
  • 8
0
votes
1 answer

Halide: X86 assembly code generation

I'm new in Halide. I am trying to compile camera_pipe application from the source code (https://github.com/halide/Halide/tree/master/apps/camera_pipe). I have successfully compiled camera_pipe.cpp. It generates "curved.s" assembly code. #…
0
votes
1 answer

Halide::Buffer on GPU

I already have an application that takes input images, copies them to GPU, and then some CUDA filters are applied to that image. So, when I want to implement a new filter, I only write the filter itself (ie. kernel), since the CPU-GPU copying logic…
9cvele3
  • 313
  • 2
  • 10
0
votes
1 answer

Halide: Demosaic algorithm bug for larger images. Seems to work for 16x16 images.

I'm trying to implement demosaic algorithm for Bayer filter as shown in section 2.8 (page 8) of this pdf: http://www.arl.army.mil/arlreports/2010/ARL-TR-5061.pdf. I'm stuck on trying to realize a function over an RDom. When I use a 16x16 image, the…
zengod
  • 1,114
  • 13
  • 26
0
votes
1 answer

global shared variable in halide #halide#

I'm trying to define a global shared variable, which counts a non-zero elements in a input, like this: counter = 0 N += select(input[x,y] > 10, 1, 0) however, this is very hard in halide, is there any global shared variable that targets this goal?
swordguy
  • 21
  • 3
0
votes
1 answer

Halide: Running BLAS operation from within a generator

I am trying to perform a matrix-matrix multiplication from within a Generator. I know I should be using define_extern as I have before with other functions, but for some reason with GEMM (i.e. BLAS' mat-mat multiply), I get a segfault. Here's my…
zanbri
  • 5,958
  • 2
  • 31
  • 41
0
votes
1 answer

Halide: Filter elements out of vector (Halide::Runtime::Buffer)

I have a Halide::Runtime::Buffer and would like to remove elements that match a criteria, ideally such that the operation occurs in-place and that the function can be defined in a Halide::Generator. I have looked into using reductions, but it seems…
zanbri
  • 5,958
  • 2
  • 31
  • 41
0
votes
1 answer

Halide: How to deal with Expr evaluated as nan or inf?

I have a 1D Func over which I'd like to perform the following: take the sum of a kernel of n values, and divide it by the sum of the kernel shifted by 1. Here's the code I have so far: Var x("x"); Func result("result"); RDom r(0,…
zanbri
  • 5,958
  • 2
  • 31
  • 41
0
votes
1 answer

Realize MaskRCNN the NMS part

I'm a starter on Halide, I'm trying to use it to accelerate maskrcnn. By now, the performance is really excellent comparing to c version. Then, I've run into a problem which has bothered me for several days: Non maximum suppression(nms), it is a…
Francois
  • 21
  • 2
0
votes
1 answer

scheduling common loop in discreet pipeline funcs

I have a number of halide pipelines (lowercase p) which all read the same input image and produce unique outputs. Some share common output dimensions, some do not. Every pipeline reads each pixel in the source image once. The output images needed…