Skip to content

Fix final null array refs in kernels#201

Open
patrickmaub wants to merge 1 commit into
Syncleus:masterfrom
patrickmaub:fix-null-array-kernel-refs
Open

Fix final null array refs in kernels#201
patrickmaub wants to merge 1 commit into
Syncleus:masterfrom
patrickmaub:fix-null-array-kernel-refs

Conversation

@patrickmaub
Copy link
Copy Markdown

Fixes #92.

Summary:

  • Detects final array fields that are null on the kernel instance.
  • Emits those fields as literal NULL pointers in generated OpenCL and omits the corresponding host-side kernel argument.
  • Skips final-null array fields when building JNI KernelArg metadata.
  • Enables the existing NullRefTest as an OpenCL-only regression and adds a codegen regression for the generated signature/body.

Testing:

  • Manual Java 8 compile with javac on JDK 21.
  • JUnitCore: com.aparapi.codegen.test.NullCheckTest, com.aparapi.codegen.test.FinalNullArrayTest, com.aparapi.runtime.NullRefTest.

Local note: the runtime OpenCL test is skipped on my machine because the Aparapi/OpenCL native library is not loadable here; the codegen regression verifies the null array is no longer passed through JNI and is initialized as NULL in the kernel.

This PR is intended to claim the bounty on #92. Payout details can be provided if accepted.

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] Can not send null references to kernel

1 participant