[code-reflection] RFR: [hat][proposal] Analysis for constants before the codegen [v7]
Juan Fumero
jfumero at openjdk.org
Thu Sep 25 07:57:42 UTC 2025
> How to test?
>
>
> HAT=SHOW_CODE java @hat/test ffi-opencl oracle.code.hat.TestConstants
>
>
> Whole suite:
>
>
> HAT=SHOW_CODE java @hat/test suite ffi-opencl
>
>
> Example:
>
>
> @CodeReflection
> public static void vectorWithConstants(@RO KernelContext kc, @RO S32Array arrayA, @RO S32Array arrayB, @RW S32Array arrayC) {
> final int BM = 100;
> if (kc.x < kc.gsx) {
> final int valueA = arrayA.array(kc.x);
> final int valueB = arrayB.array(kc.x);
> arrayC.array(kc.x, (BM + valueA + valueB));
> }
> }
>
>
> Generated code:
>
>
> __kernel void vectorWithConstants(
> __global KernelContext_t* kc,
> __global S32Array_t* arrayA,
> __global S32Array_t* arrayB,
> __global S32Array_t* arrayC
> ){
> const int BM = 100;
> if(get_global_id(0)<get_global_size(0)){
> const int valueA = arrayA->array[(long)get_global_id(0)];
> const int valueB = arrayB->array[(long)get_global_id(0)];
> arrayC->array[(long)get_global_id(0)]=BM+valueA+valueB;
> }
> return;
> }
Juan Fumero has updated the pull request incrementally with one additional commit since the last revision:
[hat] Add tests with multiple calls that contain finals
-------------
Changes:
- all: https://git.openjdk.org/babylon/pull/575/files
- new: https://git.openjdk.org/babylon/pull/575/files/6e09fb14..13bdceeb
Webrevs:
- full: https://webrevs.openjdk.org/?repo=babylon&pr=575&range=06
- incr: https://webrevs.openjdk.org/?repo=babylon&pr=575&range=05-06
Stats: 56 lines in 1 file changed: 55 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/babylon/pull/575.diff
Fetch: git fetch https://git.openjdk.org/babylon.git pull/575/head:pull/575
PR: https://git.openjdk.org/babylon/pull/575
More information about the babylon-dev
mailing list