Open saurabhkm opened 7 years ago
Did you get anywhere with this? I'm having the same issue. I've tried it on both Windows and OSX, each with the same error.
I think it might be happening because the function render_metadata is not getting defined, or at least not correctly. If in examples/main.cpp I do this:
theFunc.compile_to_header(argv[1] + std::string("_Header"), arguments, argv[2], target);
I can see by looking at the generated header that render_metadata is declared:
const struct halide_filter_metadata_t *render_metadata() HALIDE_FUNCTION_ATTRS;
Using the other theFunc.compile_to_XXX()'s to generate different types I wasn't able to find any definition of render_metadata.
In examples/lib/halide-lib-binder.coffee:
@renderLibrary = ffi.DynamicLibrary( libpath, DLFLAGS.RTLD_NOW )
rawfn = @renderLibrary.get fnname
struct = @renderLibrary.get fnname + "_metadata"
struct = struct.reinterpret(HalideFilterMetadata.size)
metadata = new HalideFilterMetadata(struct)
The library is loaded correctly and render_metadata is found, but the cast appears to leave "metadata" corrupted and metadata.version is uninitialized. I searched through the Halide code and couldn't find any reference to "render_metadata".
Unfortunately I'm out of ideas - any help on this would be greatly appreciated.
I can take a look. I haven't been following changes in Atom or Halide for a while, but maybe it won't be too tough to get to the bottom of this. Once I remember how it worked, I mean.
That'd be fantastic Dan, let me know if I can do anything.
I had an additional problem before I could get the libHalide.dylib in the binary release of Halide to load. First off, I had to change the Makefile (which referred to libHalide.so) and then I had to deal with the fact that the library expected to be at a different (absolute) path on disk. I suspect this wouldn't have been an issue if I had built Halide from source since it might still make the .so and the path to it would match its path on disk.
For the original issue, the struct halide_filter_metadata_t definition doesn't appear to have changed (still has a version as the first 32-bit value and its value is expected to be 0), but if I'm reading that header right, the render_metadata entry is now a function that returns a pointer to a struct and not the struct itself, so I need to add code to call it and handle the result, I think.
Not sure if it helps but I added the install_name_tool line to the following in examples/Makefile to deal with the path issue:
mkdir -p build
install_name_tool -change /Users/halidenightly/build_bot_new/worker/mac-64-trunk/halide-build/bin/libHalide.dylib @executable_path/bin/libHalide.dylib ./$<
./$< build/$* render
sleep 60```
A little more info: the filter metadata call was easy enough to fix, but then I realized the format of the structs used to describe the filters arguments has changed. Once I got that sorted out I realized the structs that describe buffer configuration (strides, extents, etc) has also substantially changed.
So... that's taking me a while to sort out.
Thanks Dan, I appreciate your time - I'll donate a case of beer to the cause, not that that will cover the cost of your time.
I think this will work, though I only tried it on the Mac: https://github.com/halide/atom/commit/523238d944596e5abcbe3e3c54ccc3453c419643
Works! Now how can I pay you for the beer?
No worries. I don't drink beer and it was kinda fun to dust this off again and get it operational (apologies to @saurabhkm for not responding to the original post -- better late than never, I guess).
How about just doing something cool and sharing a video demo?
The donation doesn’t need to be for beer I won’t get you to show me a receipt ;) how about coffee for a week? but I can also do a video.
The tool is very cool and makes learning Halide a breeze - you’ve saved us all a ton of time.
Ha, money does not mean that much to me. Hearing that at least a few folks have found this useful is far better than any monetary compensation.
DT
Ok cool, I'll do a video for it soon.
Sorry Dan, I still do intend to do the video but I need to spend some more time with Halide before I can do that in a way that's different to yours. Unfortunately I have some fires to put out before I can get back to it, but it'll happen.
I have followed the steps listed down and also given the location of Halide extraction folder. But I get this error in the preview pane for any of the example files I open. Toggling the preview doesn't help either.