Skip to content

Fix primitive boolean field lookup#17

Open
gshaowei6 wants to merge 1 commit into
Syncleus:masterfrom
gshaowei6:fix-primitive-boolean-field-signature
Open

Fix primitive boolean field lookup#17
gshaowei6 wants to merge 1 commit into
Syncleus:masterfrom
gshaowei6:fix-primitive-boolean-field-signature

Conversation

@gshaowei6
Copy link
Copy Markdown

Fixes Syncleus/aparapi#91.

Primitive instance boolean kernel fields currently fail before OpenCL execution because the native argument reader looks up the Java field with JNI signature B and reads it via GetByteField. Java boolean fields use signature Z, so a kernel like private boolean isInverse = true; throws NoSuchFieldError: ... isInverse B on the GPU path.

This matches the existing static boolean path, which already uses Z and GetStaticBooleanField, and keeps the OpenCL argument size unchanged because jboolean is still passed as the one-byte scalar used by the generated char kernel argument.

Validation performed:

  • Reproduced the current failure with the issue's minimal boolean-kernel shape on Windows/OpenCL: NoSuchFieldError ... isInverse B.
  • Checked the generated OpenCL still emits a scalar char argument and if (this->isInverse!=0).
  • Ran git diff --check.

@gshaowei6
Copy link
Copy Markdown
Author

Additional validation after opening the PR:

  • Built the patched native DLLs with the project Docker builder after initializing the java submodule and running ./buildMingW.sh in a clean container copy.
  • Overrode the local aparapi-jni classpath resources with the patched Windows x64 DLLs and reran the issue's minimal primitive-boolean kernel.
  • Before this fix, the same probe failed with NoSuchFieldError: ... isInverse B; with the patched DLL it completes on OpenCL and reports runningCL=true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty $20] Codegen fails on singular boolean values

1 participant