-
Notifications
You must be signed in to change notification settings - Fork 22
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
Support for Generalized Buffer Type in Hat SPIR-V Backend #298
base: code-reflection
Are you sure you want to change the base?
Conversation
👋 Welcome back hanklo6! A progress list of the required criteria for merging this PR into |
@hanklo6 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 1 new commit pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the As you do not have Committer status in this project an existing Committer must agree to sponsor your change. ➡️ To flag this PR as ready for integration with the above commit message, type |
Nice work. Do the changes you made to the violajones example suggest that there is a mismatch between the layout of the buffer interfaces described by |
moduleTypes.add("ptr" + name + "Array"); | ||
} | ||
|
||
private void generateTypeDeclaration(Object... args) { |
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.
@grfrost can better advise, but if possible it might be better to work directly off the MemoryLayout
objects used by the buffer, that's also a more general solution.
@PaulSandoz It might be the reason. However, I examined other fields in Stage, and only the The issue arises when passing the object to another SPIR-V function throught parameter, causing certain values within it to change unexpectedly. However, directly accessing the object field inside another object works correctly. I think it might be due to an incorrect storage class or some hidden mechanism in SPIR-V parameter handling that I don't fully understand. |
Ok, certainly that's odd given one would presumably expect the passing of pointers. I hope its not some nasty SPIRV compiler bug. I wonder what happens if you swap the Also, did you verify it produces the same results (within some epsilon)? |
I got the same result after swapping the For verification, I compared the detected faces and the number of faces with the results from the code running on my MacOS OpenCL backend, and both detected the same faces and number of faces. |
This PR introduces support for generalized buffer by creating SPIRV type structure and arrays in the generated module. Most of the implementation references the OpenCL Hat builder. The SPIR-V module assumes the same memory layout as the java buffer object, provided there is not additional customized padding between fields. Also, generated dependent functions from callgraph instead of using code model to resolve the issue where private functions can't be accessed.
The blackscholes, mandel, and violajones examples now run successfully. However, the violajones example still gets wrong value when accessing
threshold
fromstage
insideisAFaceStage
function, so I currently update the condition tosumOfThisStage > threshold
.For machines that don't have
float64
capability, enableFP64
emulation by setting the environment variable:OverrideDefaultFP64Settings=1
andIGC_EnableDPEmulation=1
before running. For more details: https://github.com/intel/compute-runtime/blob/master/opencl/doc/FAQ.md#feature-double-precision-emulation-fp64Progress
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/babylon.git pull/298/head:pull/298
$ git checkout pull/298
Update a local copy of the PR:
$ git checkout pull/298
$ git pull https://git.openjdk.org/babylon.git pull/298/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 298
View PR using the GUI difftool:
$ git pr show -t 298
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/babylon/pull/298.diff
Using Webrev
Link to Webrev Comment