-
Notifications
You must be signed in to change notification settings - Fork 581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MKL-DNN How to create an array of mkldnn_primitive needed by mkldnn_stream_submit #251
Comments
Sorry for the late answer, forgot about this issue. |
FWIF, I tried using PointerPointer, but, while it does compile and run, it crashes the JVM (without the core dump if I remember well!). I guess it's because the size of the generic pointer structure and the size of |
We need to overload the methods for this to work. I've just pushed a commit for that, so it should work now. Thanks for reporting! |
Thanks for looking into this. This was even a much bigger issue than I reported at first. The reported issue had a workaround, but the same issue bites in I'll try the latest snapshots and see whether this issue has been solved. However, there is a new issue or, rather, annoyance, with the latest changes: now PointerPointer overload has been introduced as an alternative even in places where this does not make sense. For example, the method |
@saudet Looking at the changes in the code, I am not sure how this is supposed to be used. I get the overloads, that part is clear: the methods now accept PointerPointer. But I am not sure what is the right way to create that PointerPointer with specific types such as mkldnn_primitive. Should vanilla PointerPointer methods work as-is with mkldnn_primitive? Basically, if I create a PointerPointer, and fill its positions with mkldnn_primitive's, I am doing it like it is supposed to be done? |
Reply to future self and the posterity: @saudet |
@saudet It turns out I couldn't make it work with PointerPointer. It crashes the VM:
This is a pseudocode for what I did (I did it from Clojure, so I don't have the actual Java example to post):
I am not sure whether I used The rest of the code works fine when I submit |
OK, new note for posterity: I am not sure whether this is a bug or I didn't get quite well the difference between these two flawors of put. |
I'm pretty sure |
I am sure that vanilla
|
Ok, I'm pretty sure it's unrelated to JavaCPP, but you could create a code snippet that fails? |
I could, but that would require writing at least a few hundreds of lines of verbose Java to recreate a minimal example, so not really :) (I'm doing this in Clojure) I wanted to edit the original example that you provided https://github.com/bytedeco/javacpp-presets/tree/master/mkl-dnn, but it is using the C++ API that have special Anyway, I can consider the issue that I had resolved and I hope that other people will either not dig that deep into the C API or will find this if they do. |
I spent a lot of time and tried to wrestle basic javacpp.Pointer to do this, but without success by now.
in MKL-DNN C api, there is the following method:
When i try it with
n = 1
and a single primitive, that works well.However, the function is clearly intended to accept
n > 1
and an array of primitives. This is also what examples provided in the mkl-dnn github repository show. The trouble is: in C, the type of the element and the type of the array are the same. I can simply provide a pointer to the first element, and the api will use the information contained in then
argument to access the whole array.In Java, I'd expect the method to either accept a
mkldnn_primitive
array, ormkldnn_primitive
to support creating a pointer to the native array of its type. However, unlike other pointer types such asmkldnn_primitive_at_t
, which do offer constructors that support size, and methods such asposition
andput
that can be used to fill in the array,mkldnn_primitive
does not.Is this intentional, or an oversight?
If it is intentional, what is the recommended way of building array arguments for methods such as
mkldnn_stream_submit
?The text was updated successfully, but these errors were encountered: