-
Notifications
You must be signed in to change notification settings - Fork 117
[rocisa] Use comgr instead of calling amdclang++ #1952
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
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok if ci pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's land #1951 first since that introduces a structural improvement.
This needs more work to not leak and be exception safe and should be implemented in the helper.cpp introduced in the above.
Also, please don't land those cmake changes to rocm_path. I couldn't follow why they were needed so we can discuss more what the intent is.
// Create data set and add the input data | ||
CHECK_COMGR(amd_comgr_create_data_set(&dataSet)); | ||
CHECK_COMGR(amd_comgr_create_data_set(&outputDataSet)); | ||
CHECK_COMGR(amd_comgr_data_set_add(dataSet, data)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if any of these get an error and throw? As I read it, every one of them leaks memory.
You need to rewrite this so that your allocated entities are contained by a raii instance that will deallocate any allocated things on destruction. See #1951 for one (of many) ways you can do this to bridge to a c based API safely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change to unique_ptr instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that is a good way: these have explicit apis for create/release and do not have the same semantics as delete with respect to nullptr afaict. But I'll have a look at what you come up with.
Merge after #1951 is merged |
4d47f27
to
70046a7
Compare
d51a5ee
to
e1c0a12
Compare
I tested this on Windows, and indeed, we are going to need more work there. The issue is that you can't just have a cross-filesystem dep on a DLL like this (which is what a Python extension is) without making arrangements for how to find it at runtime (i.e. there is no RPATH on Windows).
The Python frameworks solve this in one of two ways:
Neither option is particularly satisfying for this kind of situation. In this case, since it is a build-only dep, we would most likely want to emulate the Linux RPATH mechanic to ensure the DLL is loaded properly. However, doing that properly will require a bit more pre-work. Could we put this change on ice for a little while? I know roughly how to enable it but have other priorities right this minute and would like to come up with a mechanism that will work for any ROCm project vs just a one off. If this becomes urgent, I could do something project specific in a few hours if needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking request changes per the above discussion. We can apply this once a bit more work is done on the windows side.
Use comgr C API instead of calling amdclang++ directly.