[code-reflection] Withdrawn: [hat][proposal] Analysis for constants before the codegen
Juan Fumero
jfumero at openjdk.org
Thu Sep 25 09:11:11 UTC 2025
On Wed, 17 Sep 2025 14:08:53 GMT, Juan Fumero <jfumero at openjdk.org> wrote:
> 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;
> }
This pull request has been closed without being integrated.
-------------
PR: https://git.openjdk.org/babylon/pull/575
More information about the babylon-dev
mailing list