From asotona at openjdk.org Mon Dec 1 08:17:53 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 1 Dec 2025 08:17:53 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support Message-ID: - `BytecodeGenerator` performs proprietary lowering transformation - `OpBuilder` and tests adjusted to do not lower before calling `BytecodeGenerator` - `BytecodeGenerator.ConstantLabelSwitchOp` is an internal lowered representation of `JavaOp.JavaSwitchOp` with constant labels, and it generates `tableswitch` or `lookupswitch` instruction - post-processing transformations are slightly refactored ------------- Commit messages: - switch operand fix - nit rename - imports reorder - imports reorder - tableswitch and lookupswitch generation - BytecodeGenerator.ConstantLabelSwitchOp work in progress - selective lowering in BytecodeGenerator - BytecodeGenerator cleanup Changes: https://git.openjdk.org/babylon/pull/706/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=00 Stats: 315 lines in 15 files changed: 176 ins; 93 del; 46 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From maurizio.cimadamore at oracle.com Mon Dec 1 10:12:38 2025 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Mon, 1 Dec 2025 10:12:38 +0000 Subject: Where does the code model stored in the class file In-Reply-To: References: Message-ID: Hi Nadeesh, the translation strategy has morphed a little... now all the code models are generated into a separate static nested class -- in this case: build/hat-example-mandel-1.0.classes/mandel/Main$$CM.class We did this to limit the size of the generated code by sharing common code patterns among all the code models in a class (see https://git.openjdk.org/babylon/pull/679) Hope this helps Maurizio On 29/11/2025 00:26, nadeesh t v wrote: > Hello, > IIRC some of the talks, ?code models are stored in class files. But > when I have inspected the class file of one of the example > s?from > HAT using *javap*, I have not seen that in the class file. > > javap -c -v build/hat-example-mandel-1.0.classes/mandel/Main.class > > > Have I overlooked the class file or is it not in the class file? > > -- > Thanks and Regards, > Nadeesh TV > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From juan.fumero at oracle.com Mon Dec 1 10:23:06 2025 From: juan.fumero at oracle.com (Juan Jose Fumero Alfonso) Date: Mon, 1 Dec 2025 10:23:06 +0000 Subject: [External] : Re: Babylon building document correction In-Reply-To: References: Message-ID: Hi Nadeesh, Thank you. Feel free to open a PR. Juan From: nadeesh t v Date: Saturday, 29 November 2025 at 01:16 To: Juan Jose Fumero Alfonso Cc: babylon-dev at openjdk.org Subject: [External] : Re: Babylon building document correction Hello, Some minor corrections and improvements to the HAT building doc. On Fri, Nov 28, 2025 at 11:06?AM nadeesh t v > wrote: Thank you very much. -- Thanks and Regards, Nadeesh TV -------------- next part -------------- An HTML attachment was scrubbed... URL: From mcimadamore at openjdk.org Mon Dec 1 10:31:25 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 1 Dec 2025 10:31:25 GMT Subject: [code-reflection] Integrated: Fix javadoc issues In-Reply-To: References: Message-ID: On Fri, 28 Nov 2025 12:46:11 GMT, Maurizio Cimadamore wrote: > This simple PR fixes some issues preventing `make docs` to complete normally. This pull request has now been integrated. Changeset: fa097e59 Author: Maurizio Cimadamore URL: https://git.openjdk.org/babylon/commit/fa097e590fc5bcbf74b75a123939cadad59b3ed3 Stats: 10 lines in 4 files changed: 2 ins; 2 del; 6 mod Fix javadoc issues Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/715 From mcimadamore at openjdk.org Mon Dec 1 10:32:21 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 1 Dec 2025 10:32:21 GMT Subject: git: openjdk/babylon: code-reflection: 2 new changesets Message-ID: <98f27c59-aa33-4abc-af4f-834864f803d3@openjdk.org> Changeset: fa097e59 Branch: code-reflection Author: Maurizio Cimadamore Date: 2025-12-01 10:28:58 +0000 URL: https://git.openjdk.org/babylon/commit/fa097e590fc5bcbf74b75a123939cadad59b3ed3 Fix javadoc issues Reviewed-by: psandoz ! src/jdk.compiler/share/classes/module-info.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/FieldRef.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/MethodRef.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/interpreter/Interpreter.java Changeset: b07ea22c Branch: code-reflection Author: Maurizio Cimadamore Date: 2025-12-01 10:29:26 +0000 URL: https://git.openjdk.org/babylon/commit/b07ea22c6cac90defb932c39425461f9922eccb7 Remove minor unnecessary changes from main javac codebase Reviewed-by: psandoz ! src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java ! src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/CodeReflectionSymbols.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java From mcimadamore at openjdk.org Mon Dec 1 10:32:25 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 1 Dec 2025 10:32:25 GMT Subject: [code-reflection] Integrated: Remove minor unnecessary changes from main javac codebase In-Reply-To: References: Message-ID: On Wed, 26 Nov 2025 18:36:24 GMT, Maurizio Cimadamore wrote: > This PR undoes some unnecessary changes to the javac code: > * `LambdaToMethod` still mentions the `QUOTABLE` flag, which is no longer in use > * `Symtab` has an helper method to load classes from a string name, but that's not really required > * `TreeInfo` defines a new helper function to detect `super` in an expression. Further analysis revealed this was unnecessary (as we can piggy back on the method reference kind instead) This pull request has now been integrated. Changeset: b07ea22c Author: Maurizio Cimadamore URL: https://git.openjdk.org/babylon/commit/b07ea22c6cac90defb932c39425461f9922eccb7 Stats: 45 lines in 5 files changed: 6 ins; 32 del; 7 mod Remove minor unnecessary changes from main javac codebase Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/711 From mcimadamore at openjdk.org Mon Dec 1 10:47:16 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 1 Dec 2025 10:47:16 GMT Subject: [code-reflection] Integrated: Refactor code for computing denotable projection of types In-Reply-To: References: Message-ID: On Tue, 25 Nov 2025 19:07:45 GMT, Maurizio Cimadamore wrote: > The code reflection support needs a way to compute the closest fully denotable supertype of the type of an expression. To do this we build on [type projections](https://docs.oracle.com/javase/specs/jls/se25/html/jls-4.html#jls-4.10.5), but this doesn't work fully, because type projectios still allow intersection types in, and the `JavaType` API (or the `j.l.r.Type` API) doesn't have a way to model these. > > For this reason, we had to tweak the compiler code in `Types` to accept an extra parameter to tell the projection to also discard intersection/union types. While this works, this creates a lot of noise in the compiler codebase, so I've been looking for a lower-maintenance alternative. > > The basic idea behind this PR is to apply a normalization pass _before_ we compute a vanilla type projection. This normalization pass essentially replaces any intersection type with a fresh type variable whose bound is the first bound of the intersection. > > As an example, consider the type: `Foo`: > > 1. we first transform this type into `Foo<#1>` where `#1` is a fresh type-variable with upper bound `A` > 2. we then add `#1` to the list of type variables to be "projected" > 3. we then compute the upward projectin of `Foo<#1>`, and obtain `Foo`. > > This process is sound because (a) replacing `A & B & C` with a fresh type variable with bound `A & B & C` is sound, and because (b) upward projection will always map such type variables into some kind of wildcard (so dropping some bounds from the intersection doesn't make any difference) -- unless the type is a toplevel type, in which case, again dropping a bound doesn't make any difference. This pull request has now been integrated. Changeset: e458d3fe Author: Maurizio Cimadamore URL: https://git.openjdk.org/babylon/commit/e458d3fe74afcb15c65ce70119603b1dbe8c43e7 Stats: 334 lines in 3 files changed: 244 ins; 76 del; 14 mod Refactor code for computing denotable projection of types Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/707 From mcimadamore at openjdk.org Mon Dec 1 10:50:47 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 1 Dec 2025 10:50:47 GMT Subject: git: openjdk/babylon: code-reflection: Refactor code for computing denotable projection of types Message-ID: Changeset: e458d3fe Branch: code-reflection Author: Maurizio Cimadamore Date: 2025-12-01 10:44:32 +0000 URL: https://git.openjdk.org/babylon/commit/e458d3fe74afcb15c65ce70119603b1dbe8c43e7 Refactor code for computing denotable projection of types Reviewed-by: psandoz ! src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java ! test/langtools/tools/javac/reflect/DenotableTypesTest.java From jfumero at openjdk.org Mon Dec 1 12:04:29 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 1 Dec 2025 12:04:29 GMT Subject: [code-reflection] RFR: [hat] Cleanup F16 name impl Message-ID: <6jtPkUkLmb9aPfSmhmW7OMvlHcA5MD8Rgn92Uj7Ydms=.18276b1f-4fb0-4033-ba9e-005c13463d24@github.com> Cleanup F16 name impl ------------- Commit messages: - [hat] Cleanup F16 name impl Changes: https://git.openjdk.org/babylon/pull/717/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=717&range=00 Stats: 4 lines in 2 files changed: 0 ins; 3 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/717.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/717/head:pull/717 PR: https://git.openjdk.org/babylon/pull/717 From jfumero at openjdk.org Mon Dec 1 12:06:37 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 1 Dec 2025 12:06:37 GMT Subject: git: openjdk/babylon: code-reflection: [hat] Cleanup F16 name impl Message-ID: <095cf68e-1ec2-4b63-ab47-ecf4e9813446@openjdk.org> Changeset: 8f3399d3 Branch: code-reflection Author: Juan Fumero Date: 2025-12-01 12:05:44 +0000 URL: https://git.openjdk.org/babylon/commit/8f3399d3959e15a6326dd7773138b848d4ac6153 [hat] Cleanup F16 name impl ! hat/core/src/main/java/hat/buffer/F16Array.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java From jfumero at openjdk.org Mon Dec 1 12:08:30 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 1 Dec 2025 12:08:30 GMT Subject: [code-reflection] Integrated: [hat] Cleanup F16 name impl In-Reply-To: <6jtPkUkLmb9aPfSmhmW7OMvlHcA5MD8Rgn92Uj7Ydms=.18276b1f-4fb0-4033-ba9e-005c13463d24@github.com> References: <6jtPkUkLmb9aPfSmhmW7OMvlHcA5MD8Rgn92Uj7Ydms=.18276b1f-4fb0-4033-ba9e-005c13463d24@github.com> Message-ID: On Mon, 1 Dec 2025 11:58:43 GMT, Juan Fumero wrote: > Cleanup F16 name impl This pull request has now been integrated. Changeset: 8f3399d3 Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/8f3399d3959e15a6326dd7773138b848d4ac6153 Stats: 4 lines in 2 files changed: 0 ins; 3 del; 1 mod [hat] Cleanup F16 name impl ------------- PR: https://git.openjdk.org/babylon/pull/717 From gfrost at openjdk.org Mon Dec 1 15:30:03 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 1 Dec 2025 15:30:03 GMT Subject: git: openjdk/babylon: code-reflection: Make it easier to create simple schemas Message-ID: <2ac233c0-237d-4cee-887a-b36a5568a0aa@openjdk.org> Changeset: 15e442c8 Branch: code-reflection Author: Gary Frost Date: 2025-12-01 15:26:31 +0000 URL: https://git.openjdk.org/babylon/commit/15e442c8679ddae7cbb01611a7e860972a97ec0c Make it easier to create simple schemas = hat/core/src/main/java/hat/annotations/After.java = hat/core/src/main/java/hat/annotations/Align.java = hat/core/src/main/java/hat/annotations/Order.java = hat/core/src/main/java/hat/annotations/Pad.java = hat/core/src/main/java/hat/annotations/ProvidesDimFor.java ! hat/core/src/main/java/hat/buffer/ArgArray.java ! hat/core/src/main/java/hat/buffer/Buffer.java ! hat/core/src/main/java/hat/buffer/F32Array.java ! hat/core/src/main/java/hat/buffer/F32ArrayPadded.java - hat/core/src/main/java/hat/buffer/HATVector.java ! hat/core/src/main/java/hat/buffer/KernelBufferContext.java ! hat/core/src/main/java/hat/buffer/S32Array.java ! hat/core/src/main/java/hat/ifacemapper/Schema.java From gfrost at openjdk.org Mon Dec 1 15:30:26 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 1 Dec 2025 15:30:26 GMT Subject: [code-reflection] Integrated: Make it easier to create simple schemas Message-ID: An attempt to simplify the creation of simple schemas. We may be able to extend this approach (skipping the builder) to other more complex schemas later. ------------- Commit messages: - Make it easier to create simple schemas Changes: https://git.openjdk.org/babylon/pull/718/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=718&range=00 Stats: 139 lines in 13 files changed: 56 ins; 54 del; 29 mod Patch: https://git.openjdk.org/babylon/pull/718.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/718/head:pull/718 PR: https://git.openjdk.org/babylon/pull/718 From gfrost at openjdk.org Mon Dec 1 15:30:26 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 1 Dec 2025 15:30:26 GMT Subject: [code-reflection] Integrated: Make it easier to create simple schemas In-Reply-To: References: Message-ID: <-PArnFzaR_9tm4TyEIT6g5EdCKAxp9u30NZr6PLihFs=.a25b2be9-69a4-443a-8117-03b5771fff3e@github.com> On Mon, 1 Dec 2025 15:23:32 GMT, Gary Frost wrote: > An attempt to simplify the creation of simple schemas. We may be able to extend this approach (skipping the builder) to other more complex schemas later. This pull request has now been integrated. Changeset: 15e442c8 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/15e442c8679ddae7cbb01611a7e860972a97ec0c Stats: 139 lines in 13 files changed: 56 ins; 54 del; 29 mod Make it easier to create simple schemas ------------- PR: https://git.openjdk.org/babylon/pull/718 From gfrost at openjdk.org Mon Dec 1 15:42:26 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 1 Dec 2025 15:42:26 GMT Subject: [code-reflection] Integrated: Replace string literals with class names with references to Class apis Message-ID: We had a few references to class names as String literals, I replaced with Class.getSimpleName() so that we can safely refactor code (rename classes). ------------- Commit messages: - Replace string literals with class names with references to Class apis Changes: https://git.openjdk.org/babylon/pull/719/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=719&range=00 Stats: 7 lines in 3 files changed: 1 ins; 2 del; 4 mod Patch: https://git.openjdk.org/babylon/pull/719.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/719/head:pull/719 PR: https://git.openjdk.org/babylon/pull/719 From gfrost at openjdk.org Mon Dec 1 15:42:27 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 1 Dec 2025 15:42:27 GMT Subject: [code-reflection] Integrated: Replace string literals with class names with references to Class apis In-Reply-To: References: Message-ID: On Mon, 1 Dec 2025 15:35:22 GMT, Gary Frost wrote: > We had a few references to class names as String literals, I replaced with Class.getSimpleName() so that we can safely refactor code (rename classes). This pull request has now been integrated. Changeset: 76e4d3b7 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/76e4d3b785a1c63b536a93fcc4d70e6db7aba1eb Stats: 7 lines in 3 files changed: 1 ins; 2 del; 4 mod Replace string literals with class names with references to Class apis ------------- PR: https://git.openjdk.org/babylon/pull/719 From gfrost at openjdk.org Mon Dec 1 15:44:24 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 1 Dec 2025 15:44:24 GMT Subject: git: openjdk/babylon: code-reflection: Replace string literals with class names with references to Class apis Message-ID: <43105d2c-0acd-474e-9d0f-5774cff73db7@openjdk.org> Changeset: 76e4d3b7 Branch: code-reflection Author: Gary Frost Date: 2025-12-01 15:39:35 +0000 URL: https://git.openjdk.org/babylon/commit/76e4d3b785a1c63b536a93fcc4d70e6db7aba1eb Replace string literals with class names with references to Class apis ! hat/core/src/main/java/hat/buffer/F16.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/CodeBuilder.java From jfumero at openjdk.org Mon Dec 1 15:59:19 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 1 Dec 2025 15:59:19 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 Message-ID: This PR introduces the type [`bfloat16`](https://cloud.google.com/blog/products/ai-machine-learning/bfloat16-the-secret-to-high-performance-on-cloud-tpus) for HAT. Testing for OpenCL: HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestBFloat16Type Testing for CUDA: HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-cuda hat.test.TestBFloat16Type Some tests are expecting to fail due to precision error. We will need to improve the type conversion with round-to-nearest-even for example. ------------- Commit messages: - Merge branch 'code-reflection' into hat/type/bfloat16 - [hat] remove custom Op for bfloat - single line imports in hat code builders - single line imports in hat code builders - [hat] test matmul with bfloat16 - [hat] dialect for bfloat16 removed - [hat] new test file included in the hat test list - [hat] OpenCL handler for bfloat16 via float convs - Merge branch 'code-reflection' into hat/type/bfloat16 - [hat][wip] bfloat16 conversions for OpenCL - ... and 10 more: https://git.openjdk.org/babylon/compare/76e4d3b7...60f7140c Changes: https://git.openjdk.org/babylon/pull/716/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=716&range=00 Stats: 1517 lines in 29 files changed: 1399 ins; 44 del; 74 mod Patch: https://git.openjdk.org/babylon/pull/716.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/716/head:pull/716 PR: https://git.openjdk.org/babylon/pull/716 From nadeeshtv at gmail.com Mon Dec 1 16:01:59 2025 From: nadeeshtv at gmail.com (nadeesh t v) Date: Mon, 1 Dec 2025 17:01:59 +0100 Subject: Where does the code model stored in the class file In-Reply-To: References: Message-ID: Thank you for the information. On Mon, 1 Dec 2025 at 11:12, Maurizio Cimadamore < maurizio.cimadamore at oracle.com> wrote: > Hi Nadeesh, > the translation strategy has morphed a little... now all the code models > are generated into a separate static nested class -- in this case: > build/hat-example-mandel-1.0.classes/mandel/Main$$CM.class > > We did this to limit the size of the generated code by sharing common code > patterns among all the code models in a class (see > https://git.openjdk.org/babylon/pull/679) > > Hope this helps > > > Maurizio > On 29/11/2025 00:26, nadeesh t v wrote: > > Hello, > IIRC some of the talks, code models are stored in class files. But when I > have inspected the class file of one of the example > s from > HAT using *javap*, I have not seen that in the class file. > > javap -c -v build/hat-example-mandel-1.0.classes/mandel/Main.class > > > Have I overlooked the class file or is it not in the class file? > -- > Thanks and Regards, > Nadeesh TV > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From asotona at openjdk.org Mon Dec 1 16:00:29 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 1 Dec 2025 16:00:29 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v2] In-Reply-To: References: Message-ID: > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `BytecodeGenerator.ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. Logic for detecting constant labels and transforming them into `BytecodeGenerator.ConstantLabelSwitchOp` will be introduced in a follow-up pull request. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: - added test - ConstantLabelSwitchOp refactored out to jdk.incubator.code.bytecode.impl package ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/d5c550cb..abff6609 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=00-01 Stats: 250 lines in 3 files changed: 211 ins; 33 del; 6 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From asotona at openjdk.org Mon Dec 1 16:35:40 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 1 Dec 2025 16:35:40 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v3] In-Reply-To: References: Message-ID: > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `BytecodeGenerator.ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. Logic for detecting constant labels and transforming them into `BytecodeGenerator.ConstantLabelSwitchOp` will be introduced in a follow-up pull request. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: added javadoc ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/abff6609..a2753cba Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=02 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=01-02 Stats: 10 lines in 1 file changed: 9 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From asotona at openjdk.org Mon Dec 1 16:40:00 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 1 Dec 2025 16:40:00 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v4] In-Reply-To: References: Message-ID: > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. Logic for detecting constant labels and transforming them into `ConstantLabelSwitchOp` will be introduced in a follow-up pull request. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: - Merge remote-tracking branch 'asotona/bytecodegenerator-cleanup' into bytecodegenerator-cleanup - Lower JavaSwitchOp to ConstantLabelSwitchOp ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/a2753cba..98235aff Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=03 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=02-03 Stats: 517 lines in 4 files changed: 487 ins; 13 del; 17 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From mabbay at openjdk.org Mon Dec 1 16:50:53 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Mon, 1 Dec 2025 16:50:53 GMT Subject: [code-reflection] RFR: Detect if a java switch is case constant [v2] In-Reply-To: References: <7uiQQC2YeiLsvzGX15uYO1Lltdn1mW1wqz17hq5vsko=.ef7c6cb8-7fc9-411e-984e-4a8938f4e726@github.com> Message-ID: On Fri, 28 Nov 2025 16:05:41 GMT, Mourad Abbay wrote: >> Add the logic to check if a switch op is case constant. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Change the logic to return true only when labels in bytecode matches labels in source code I pushed the changes directly to https://github.com/openjdk/babylon/pull/706. ------------- PR Comment: https://git.openjdk.org/babylon/pull/710#issuecomment-3597667208 From mabbay at openjdk.org Mon Dec 1 16:50:55 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Mon, 1 Dec 2025 16:50:55 GMT Subject: [code-reflection] Withdrawn: Detect if a java switch is case constant In-Reply-To: <7uiQQC2YeiLsvzGX15uYO1Lltdn1mW1wqz17hq5vsko=.ef7c6cb8-7fc9-411e-984e-4a8938f4e726@github.com> References: <7uiQQC2YeiLsvzGX15uYO1Lltdn1mW1wqz17hq5vsko=.ef7c6cb8-7fc9-411e-984e-4a8938f4e726@github.com> Message-ID: On Wed, 26 Nov 2025 09:20:29 GMT, Mourad Abbay wrote: > Add the logic to check if a switch op is case constant. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/babylon/pull/710 From asotona at openjdk.org Mon Dec 1 17:07:12 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 1 Dec 2025 17:07:12 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v5] In-Reply-To: References: Message-ID: > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. > > Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: test update ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/98235aff..b9a75e2c Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=04 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=03-04 Stats: 66 lines in 1 file changed: 11 ins; 50 del; 5 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From psandoz at openjdk.org Mon Dec 1 17:07:13 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Mon, 1 Dec 2025 17:07:13 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v5] In-Reply-To: References: Message-ID: On Mon, 1 Dec 2025 17:03:34 GMT, Adam Sotona wrote: >> The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. >> >> The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. >> >> A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. >> >> Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. >> >> This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > test update src/jdk.incubator.code/share/classes/jdk/incubator/code/Block.java line 119: > 117: * @param arguments the target block arguments, a copy will be made as needed. > 118: */ > 119: public Reference(Block target, List arguments) { Why is this made public? ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/706#discussion_r2577896216 From jfumero at openjdk.org Mon Dec 1 17:11:50 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 1 Dec 2025 17:11:50 GMT Subject: [code-reflection] RFR: [hat] Testing suite - avoid log duplications Message-ID: HAT Testing framework suite - avoid log duplications ------------- Commit messages: - [hat] Testing suite - avoid log duplications Changes: https://git.openjdk.org/babylon/pull/720/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=720&range=00 Stats: 4 lines in 4 files changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.org/babylon/pull/720.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/720/head:pull/720 PR: https://git.openjdk.org/babylon/pull/720 From asotona at openjdk.org Mon Dec 1 17:12:23 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 1 Dec 2025 17:12:23 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v5] In-Reply-To: References: Message-ID: On Mon, 1 Dec 2025 16:59:07 GMT, Paul Sandoz wrote: >> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: >> >> test update > > src/jdk.incubator.code/share/classes/jdk/incubator/code/Block.java line 119: > >> 117: * @param arguments the target block arguments, a copy will be made as needed. >> 118: */ >> 119: public Reference(Block target, List arguments) { > > Why is this made public? @mabbay Do you need a help to fix the `Block.Reference` construction in the `BytecodeGenerator::getLabelsAndTargets`? ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/706#discussion_r2577927582 From asotona at openjdk.org Mon Dec 1 17:18:01 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 1 Dec 2025 17:18:01 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v5] In-Reply-To: References: Message-ID: On Mon, 1 Dec 2025 17:07:12 GMT, Adam Sotona wrote: >> The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. >> >> The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. >> >> A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. >> >> Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. >> >> This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > test update @mabbay The custom lowering transformation is probably worth to take out of the `BytecodeGenerator` into a standalone class in the `jdk.incubator.code.bytecode.impl` package. ------------- PR Comment: https://git.openjdk.org/babylon/pull/706#issuecomment-3597825167 From jfumero at openjdk.org Mon Dec 1 17:33:02 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 1 Dec 2025 17:33:02 GMT Subject: [code-reflection] Integrated: [hat] Testing suite - avoid log duplications In-Reply-To: References: Message-ID: On Mon, 1 Dec 2025 17:05:36 GMT, Juan Fumero wrote: > HAT Testing framework suite - avoid log duplications This pull request has now been integrated. Changeset: 9966c196 Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/9966c196ec80c1e57eb2198e2c71cc98c78abcca Stats: 4 lines in 4 files changed: 0 ins; 0 del; 4 mod [hat] Testing suite - avoid log duplications ------------- PR: https://git.openjdk.org/babylon/pull/720 From jfumero at openjdk.org Mon Dec 1 17:34:45 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 1 Dec 2025 17:34:45 GMT Subject: git: openjdk/babylon: code-reflection: [hat] Testing suite - avoid log duplications Message-ID: <2a798289-07bc-41a3-8755-bc286b8a1dc2@openjdk.org> Changeset: 9966c196 Branch: code-reflection Author: Juan Fumero Date: 2025-12-01 17:30:17 +0000 URL: https://git.openjdk.org/babylon/commit/9966c196ec80c1e57eb2198e2c71cc98c78abcca [hat] Testing suite - avoid log duplications ! hat/hat.java ! hat/hat/job.jar ! hat/hat/job/src/main/java/job/ForkExec.java ! hat/hat/job/src/main/java/job/Jar.java From jfumero at openjdk.org Mon Dec 1 17:55:25 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 1 Dec 2025 17:55:25 GMT Subject: [code-reflection] RFR: [hat] Testing suite - cleanup Message-ID: [hat] Testing suite - cleanup ------------- Commit messages: - [hat] Testing suite - cleanup Changes: https://git.openjdk.org/babylon/pull/722/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=722&range=00 Stats: 6 lines in 3 files changed: 0 ins; 6 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/722.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/722/head:pull/722 PR: https://git.openjdk.org/babylon/pull/722 From jfumero at openjdk.org Mon Dec 1 18:03:24 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 1 Dec 2025 18:03:24 GMT Subject: [code-reflection] Integrated: [hat] Testing suite - cleanup In-Reply-To: References: Message-ID: <6SV1PE0xUknj8ERzuwqh8MEfUsE1awnLz04tp00R0X8=.e6907f8d-1def-41f4-8e0f-9b5632e36253@github.com> On Mon, 1 Dec 2025 17:49:35 GMT, Juan Fumero wrote: > [hat] Testing suite - cleanup This pull request has now been integrated. Changeset: 0a7929cc Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/0a7929cc4ae568f9c478b80668ad0a7c7af7a57c Stats: 6 lines in 3 files changed: 0 ins; 6 del; 0 mod [hat] Testing suite - cleanup ------------- PR: https://git.openjdk.org/babylon/pull/722 From jfumero at openjdk.org Mon Dec 1 18:05:00 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 1 Dec 2025 18:05:00 GMT Subject: git: openjdk/babylon: code-reflection: [hat] Testing suite - cleanup Message-ID: <981501f5-3b32-4d3f-b939-a2cc1052c9e8@openjdk.org> Changeset: 0a7929cc Branch: code-reflection Author: Juan Fumero Date: 2025-12-01 18:00:26 +0000 URL: https://git.openjdk.org/babylon/commit/0a7929cc4ae568f9c478b80668ad0a7c7af7a57c [hat] Testing suite - cleanup ! hat/hat/job.jar ! hat/hat/job/src/main/java/job/Jar.java ! hat/tests/src/main/java/hat/test/TestDeviceType.java From mabbay at openjdk.org Mon Dec 1 19:03:29 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Mon, 1 Dec 2025 19:03:29 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v5] In-Reply-To: References: Message-ID: On Mon, 1 Dec 2025 17:09:40 GMT, Adam Sotona wrote: >> src/jdk.incubator.code/share/classes/jdk/incubator/code/Block.java line 119: >> >>> 117: * @param arguments the target block arguments, a copy will be made as needed. >>> 118: */ >>> 119: public Reference(Block target, List arguments) { >> >> Why is this made public? > > @mabbay Do you need a help to fix the `Block.Reference` construction in the `BytecodeGenerator::getLabelsAndTargets`? Yes ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/706#discussion_r2578275834 From asotona at openjdk.org Mon Dec 1 19:37:06 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 1 Dec 2025 19:37:06 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v6] In-Reply-To: References: Message-ID: > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. > > Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: - Merge remote-tracking branch 'asotona/bytecodegenerator-cleanup' into bytecodegenerator-cleanup - Change getLabelsAndTargets to returns targets as list of blocks ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/b9a75e2c..13eceb2c Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=05 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=04-05 Stats: 7 lines in 2 files changed: 0 ins; 0 del; 7 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From amaembo at gmail.com Tue Dec 2 09:58:24 2025 From: amaembo at gmail.com (Tagir Valeev) Date: Tue, 2 Dec 2025 10:58:24 +0100 Subject: An experiment: retrieve record component from accessor literal via code reflection Message-ID: Hello! A recent discussion in amber-dev [1] lead me to the following example how people may use Code Reflection. The problem: Retrieve a RecordComponent object from the corresponding record accessor method reference. Expect the following API: private record MyRecord(int comp, double comp2) {} ... RecordComponent component = ReflectUtil.component(MyRecord::comp); It looks like it's possible to solve this with Code Reflection. My solution is the following: package org.example; import jdk.incubator.code.Quoted; import jdk.incubator.code.Reflect; import jdk.incubator.code.dialect.core.CoreOp; import jdk.incubator.code.dialect.java.JavaOp; import jdk.incubator.code.dialect.java.MethodRef; import java.lang.invoke.MethodHandles; import java.lang.reflect.Method; import java.lang.reflect.RecordComponent; import java.util.Arrays; public final class ReflectUtil { @Reflect @FunctionalInterface public interface RecordAccessor { /** * @param r record type * @return result of the record component * @param an unused generic parameter to avoid accidental use with lambda * (lambdas cannot bind to generic SAM). * Only method references are supported. */ Object get(T r); } /** * @param accessor a method reference bound to a record accessor * @return record component that corresponds to a given accessor * @param record type * @throws IllegalArgumentException if the supplied argument is not a record accessor method reference * @throws RuntimeException if the record accessor cannot be resolved (e.g., due to insufficient access rights) */ public static RecordComponent component(RecordAccessor accessor) { Quoted quoted = CoreOp.QuotedOp.ofQuotable(accessor) .orElseThrow(() -> new IllegalArgumentException("Accessor must be quotable")); if (!(quoted.op() instanceof JavaOp.LambdaOp lambda)) { throw new IllegalArgumentException("Expected method reference"); } JavaOp.InvokeOp invokeOp = lambda.methodReference() .orElseThrow(() -> new IllegalArgumentException("Expected method reference")); if (invokeOp.invokeKind() != JavaOp.InvokeOp.InvokeKind.INSTANCE) { throw new IllegalArgumentException("Method reference bound to record accessor is expected"); } MethodRef descriptor = invokeOp.invokeDescriptor(); Method method; try { method = descriptor.resolveToMethod(MethodHandles.privateLookupIn(accessor.getClass(), MethodHandles.lookup())); } catch (ReflectiveOperationException e) { throw new RuntimeException("Cannot resolve descriptor "+descriptor, e); } Class recordClass = method.getDeclaringClass(); if (!recordClass.isRecord()) { throw new IllegalArgumentException("Not a record accessor method"); } return Arrays.stream(recordClass.getRecordComponents()).filter(rc -> rc.getAccessor().equals(method)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Not a record accessor: "+method)); } } I'm not completely sure if privateLookupIn is the right thing to do here. Otherwise, it's quite a pleasant experience: the code is simple and self-explanatory. LambdaOp::methodReference was very helpful. With best regards, Tagir Valeev [1] https://mail.openjdk.org/pipermail/amber-dev/2025-November/009472.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From asotona at openjdk.org Tue Dec 2 10:25:34 2025 From: asotona at openjdk.org (Adam Sotona) Date: Tue, 2 Dec 2025 10:25:34 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v7] In-Reply-To: References: Message-ID: <6-WkPm1LvBi66ya6phNm2i5wWeo9vjmzIrKfzEmyDtM=.3d8927e2-7d0f-4614-8fd7-e1f5ff0916d6@github.com> > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. > > Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: - removed obsolete block - LoweringTransform refactored out to jdk.incubator.code.bytecode.impl package ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/13eceb2c..0fe1d1f5 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=06 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=05-06 Stats: 532 lines in 3 files changed: 281 ins; 245 del; 6 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From asotona at openjdk.org Tue Dec 2 13:06:33 2025 From: asotona at openjdk.org (Adam Sotona) Date: Tue, 2 Dec 2025 13:06:33 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v7] In-Reply-To: <6-WkPm1LvBi66ya6phNm2i5wWeo9vjmzIrKfzEmyDtM=.3d8927e2-7d0f-4614-8fd7-e1f5ff0916d6@github.com> References: <6-WkPm1LvBi66ya6phNm2i5wWeo9vjmzIrKfzEmyDtM=.3d8927e2-7d0f-4614-8fd7-e1f5ff0916d6@github.com> Message-ID: On Tue, 2 Dec 2025 10:25:34 GMT, Adam Sotona wrote: >> The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. >> >> The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. >> >> A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. >> >> Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. >> >> This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. > > Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: > > - removed obsolete block > > - LoweringTransform refactored out to jdk.incubator.code.bytecode.impl package @mabbay nice job! Synthetic type factory now looks like this: public static jdk.incubator.code.extern.ExternalizedTypeElement $exterType(int); descriptor: (I)Ljdk/incubator/code/extern/ExternalizedTypeElement; flags: (0x0009) ACC_PUBLIC, ACC_STATIC Code: stack=5, locals=9, args_size=1 0: iload_0 1: tableswitch { // 0 to 146 ... ------------- PR Review: https://git.openjdk.org/babylon/pull/706#pullrequestreview-3529999325 From asotona at openjdk.org Tue Dec 2 14:46:56 2025 From: asotona at openjdk.org (Adam Sotona) Date: Tue, 2 Dec 2025 14:46:56 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v8] In-Reply-To: References: Message-ID: > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. > > Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: TestSwitch extended ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/0fe1d1f5..ffb5442c Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=07 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=06-07 Stats: 90 lines in 1 file changed: 79 ins; 1 del; 10 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From davidalayachew at gmail.com Tue Dec 2 16:28:52 2025 From: davidalayachew at gmail.com (David Alayachew) Date: Tue, 2 Dec 2025 11:28:52 -0500 Subject: An experiment: retrieve record component from accessor literal via code reflection In-Reply-To: References: Message-ID: Thanks for putting this together Tagir. It's exciting to see what babylon will be able to provide us if stuff like this is fairly easy to do. On Tue, Dec 2, 2025, 4:59?AM Tagir Valeev wrote: > Hello! > > A recent discussion in amber-dev [1] lead me to the following example how > people may use Code Reflection. > The problem: > Retrieve a RecordComponent object from the corresponding record accessor > method reference. Expect the following API: > > private record MyRecord(int comp, double comp2) {} > ... > RecordComponent component = ReflectUtil.component(MyRecord::comp); > > It looks like it's possible to solve this with Code Reflection. My > solution is the following: > > package org.example; > > import jdk.incubator.code.Quoted; > import jdk.incubator.code.Reflect; > import jdk.incubator.code.dialect.core.CoreOp; > import jdk.incubator.code.dialect.java.JavaOp; > import jdk.incubator.code.dialect.java.MethodRef; > > import java.lang.invoke.MethodHandles; > import java.lang.reflect.Method; > import java.lang.reflect.RecordComponent; > import java.util.Arrays; > > public final class ReflectUtil { > @Reflect > @FunctionalInterface > public interface RecordAccessor { > /** > * @param r record type > * @return result of the record component > * @param an unused generic parameter to avoid accidental use > with lambda > * (lambdas cannot bind to generic SAM). > * Only method references are supported. > */ > Object get(T r); > } > > /** > * @param accessor a method reference bound to a record accessor > * @return record component that corresponds to a given accessor > * @param record type > * @throws IllegalArgumentException if the supplied argument is not a > record accessor method reference > * @throws RuntimeException if the record accessor cannot be resolved > (e.g., due to insufficient access rights) > */ > public static RecordComponent > component(RecordAccessor accessor) { > Quoted quoted = CoreOp.QuotedOp.ofQuotable(accessor) > .orElseThrow(() -> new IllegalArgumentException("Accessor > must be quotable")); > if (!(quoted.op() instanceof JavaOp.LambdaOp lambda)) { > throw new IllegalArgumentException("Expected method > reference"); > } > JavaOp.InvokeOp invokeOp = lambda.methodReference() > .orElseThrow(() -> new IllegalArgumentException("Expected > method reference")); > if (invokeOp.invokeKind() != JavaOp.InvokeOp.InvokeKind.INSTANCE) { > throw new IllegalArgumentException("Method reference bound to > record accessor is expected"); > } > MethodRef descriptor = invokeOp.invokeDescriptor(); > Method method; > try { > method = > descriptor.resolveToMethod(MethodHandles.privateLookupIn(accessor.getClass(), > MethodHandles.lookup())); > } catch (ReflectiveOperationException e) { > throw new RuntimeException("Cannot resolve descriptor > "+descriptor, e); > } > Class recordClass = method.getDeclaringClass(); > if (!recordClass.isRecord()) { > throw new IllegalArgumentException("Not a record accessor > method"); > } > return Arrays.stream(recordClass.getRecordComponents()).filter(rc > -> rc.getAccessor().equals(method)) > .findFirst() > .orElseThrow(() -> new IllegalArgumentException("Not a > record accessor: "+method)); > } > } > > I'm not completely sure if privateLookupIn is the right thing to do here. > Otherwise, it's quite a pleasant experience: the code is simple and > self-explanatory. LambdaOp::methodReference was very helpful. > > With best regards, > Tagir Valeev > > > [1] https://mail.openjdk.org/pipermail/amber-dev/2025-November/009472.html > -------------- next part -------------- An HTML attachment was scrubbed... URL: From psandoz at openjdk.org Tue Dec 2 17:51:10 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Tue, 2 Dec 2025 17:51:10 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v8] In-Reply-To: References: Message-ID: On Tue, 2 Dec 2025 14:46:56 GMT, Adam Sotona wrote: >> The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. >> >> The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. >> >> A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. >> >> Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. >> >> Lowering of `BreakOp`, `SwitchFallthroughOp` and nested switches will be implemented in a follow-up PR. >> >> This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. > > Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: > > TestSwitch extended This is looking good. We should follow up to extract out validating constant expression as per the JLS, and evaluation and place on method of `JavaExpression`. We likely have some limitations validating and evaluating constant expressions because we rely on reflection to resolve to Fields. src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/impl/LoweringTransform.java line 124: > 122: } > 123: Op op = opr.op(); > 124: if (op instanceof CoreOp.ConstantOp cop) { Change all this to a switch expression. src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/impl/LoweringTransform.java line 140: > 138: Field field; > 139: try { > 140: field = fieldLoadOp.fieldDescriptor().resolveToField(lookup); Will this work for code that is being compiled as there will be no respective classes loaded? (Perhaps there are clues as to what javac does.) We might need to provide an abstraction to resolve a reference in the context of the compiler or runtime and query the referenced state. src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/impl/LoweringTransform.java line 156: > 154: } > 155: if (op instanceof JavaOp.ConditionalExpressionOp cexpr) { > 156: // bodies must yield constant expressions We need to constrain the last three ops to bodies with just one block. Relying on the cast is too fragile. src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/impl/LoweringTransform.java line 250: > 248: } > 249: > 250: static Integer extractConstantLabel(MethodHandles.Lookup lookup, Body body, Op whenToStop) { This works and is OK for now, but is a bit of a blunt hammer. Since we are dealing with expressions we should be able to traverse from the root of the constant expression tree. test/jdk/java/lang/reflect/code/bytecode/TestIsCaseConstantSwitch.java line 30: > 28: > 29: class C { > 30: static final int x = 26; What about a case label accessing a static field of `TestIsCaseConstantSwitch`? ------------- PR Review: https://git.openjdk.org/babylon/pull/706#pullrequestreview-3531342157 PR Review Comment: https://git.openjdk.org/babylon/pull/706#discussion_r2582174697 PR Review Comment: https://git.openjdk.org/babylon/pull/706#discussion_r2582179055 PR Review Comment: https://git.openjdk.org/babylon/pull/706#discussion_r2582181488 PR Review Comment: https://git.openjdk.org/babylon/pull/706#discussion_r2582209198 PR Review Comment: https://git.openjdk.org/babylon/pull/706#discussion_r2582223589 From asotona at openjdk.org Tue Dec 2 20:09:55 2025 From: asotona at openjdk.org (Adam Sotona) Date: Tue, 2 Dec 2025 20:09:55 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v9] In-Reply-To: References: Message-ID: > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. > > Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. > > Lowering of `BreakOp`, `SwitchFallthroughOp` and nested switches will be implemented in a follow-up PR. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: ConstantLabelSwitchOp adjusted to keep possition of the default target ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/ffb5442c..2994865c Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=08 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=07-08 Stats: 23 lines in 3 files changed: 12 ins; 1 del; 10 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From asotona at openjdk.org Wed Dec 3 00:22:17 2025 From: asotona at openjdk.org (Adam Sotona) Date: Wed, 3 Dec 2025 00:22:17 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v10] In-Reply-To: References: Message-ID: > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. > > Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. > > Lowering of `BreakOp`, `SwitchFallthroughOp` and nested switches will be implemented in a follow-up PR. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: - Generalize the lower transform - Keep switch cases in the same order as in source code ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/2994865c..12c3eb91 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=09 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=08-09 Stats: 225 lines in 6 files changed: 164 ins; 45 del; 16 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From asotona at openjdk.org Wed Dec 3 07:03:24 2025 From: asotona at openjdk.org (Adam Sotona) Date: Wed, 3 Dec 2025 07:03:24 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v10] In-Reply-To: References: Message-ID: <-9ej21ELFzj2GgG53VHnzoawcNbf5pHPj6pvQvBKhA0=.7c357255-c4f7-41e3-a26f-b6c95365e78d@github.com> On Wed, 3 Dec 2025 00:22:17 GMT, Adam Sotona wrote: >> The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. >> >> The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. >> >> A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. >> >> Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. >> >> Lowering of `BreakOp`, `SwitchFallthroughOp` and nested switches will be implemented in a follow-up PR. >> >> This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. > > Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: > > - Generalize the lower transform > - Keep switch cases in the same order as in source code src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/impl/LoweringTransform.java line 101: > 99: yield b; > 100: } > 101: case Lowerable lop -> lop.lower(b, null); Nested bodies should be lowered using this lowering transformation. src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java line 2148: > 2146: } > 2147: > 2148: public record BranchTarget(Block.Builder breakBlock, Block.Builder continueBlock) { This forms a new public API. Implementation code worth to internally share across the module and tests must be moved to a non-public package. The other option is to copy/paste. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/706#discussion_r2583883219 PR Review Comment: https://git.openjdk.org/babylon/pull/706#discussion_r2583879326 From mabbay at openjdk.org Wed Dec 3 10:03:59 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 3 Dec 2025 10:03:59 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v10] In-Reply-To: <-9ej21ELFzj2GgG53VHnzoawcNbf5pHPj6pvQvBKhA0=.7c357255-c4f7-41e3-a26f-b6c95365e78d@github.com> References: <-9ej21ELFzj2GgG53VHnzoawcNbf5pHPj6pvQvBKhA0=.7c357255-c4f7-41e3-a26f-b6c95365e78d@github.com> Message-ID: On Wed, 3 Dec 2025 06:59:06 GMT, Adam Sotona wrote: >> Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: >> >> - Generalize the lower transform >> - Keep switch cases in the same order as in source code > > src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java line 2148: > >> 2146: } >> 2147: >> 2148: public record BranchTarget(Block.Builder breakBlock, Block.Builder continueBlock) { > > This forms a new public API. > Implementation code worth to internally share across the module and tests must be moved to a non-public package. The other option is to copy/paste. Copy paste is not going to work, because for example BreakOp.lower depends on JavaOp.BranchTarget. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/706#discussion_r2584429682 From asotona at openjdk.org Wed Dec 3 10:32:39 2025 From: asotona at openjdk.org (Adam Sotona) Date: Wed, 3 Dec 2025 10:32:39 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v11] In-Reply-To: References: Message-ID: > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. > > Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. > > Lowering of `BreakOp`, `SwitchFallthroughOp` and nested switches will be implemented in a follow-up PR. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: lower the case bodies of a switch recursively ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/12c3eb91..d6821ba3 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=10 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=09-10 Stats: 10 lines in 1 file changed: 0 ins; 5 del; 5 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From asotona at openjdk.org Wed Dec 3 10:42:33 2025 From: asotona at openjdk.org (Adam Sotona) Date: Wed, 3 Dec 2025 10:42:33 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v12] In-Reply-To: References: Message-ID: > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. > > Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. > > Lowering of `BreakOp`, `SwitchFallthroughOp` and nested switches will be implemented in a follow-up PR. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: replace if with switch ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/d6821ba3..d8f88d64 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=11 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=10-11 Stats: 14 lines in 1 file changed: 2 ins; 1 del; 11 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From asotona at openjdk.org Wed Dec 3 11:05:43 2025 From: asotona at openjdk.org (Adam Sotona) Date: Wed, 3 Dec 2025 11:05:43 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v13] In-Reply-To: References: Message-ID: <862Srn8X67Cst33_51BkbQZ2q_nDTvFKVZKkbKg-wTI=.1a40b83d-7ee3-4709-b5ac-7d67c75a4c5a@github.com> > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. > > Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. > > Lowering of `BreakOp`, `SwitchFallthroughOp` and nested switches will be implemented in a follow-up PR. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: - BranchTarget moved from JavaOp into jdk.incubator.code.internal package - replace if with switch ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/d8f88d64..811f061a Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=12 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=11-12 Stats: 161 lines in 3 files changed: 55 ins; 39 del; 67 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From jfumero at openjdk.org Wed Dec 3 11:53:56 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 3 Dec 2025 11:53:56 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v2] In-Reply-To: References: Message-ID: > This PR introduces the type [`bfloat16`](https://cloud.google.com/blog/products/ai-machine-learning/bfloat16-the-secret-to-high-performance-on-cloud-tpus) for HAT. > > Testing for OpenCL: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestBFloat16Type > > > Testing for CUDA: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-cuda hat.test.TestBFloat16Type > > > Some tests are expecting to fail due to precision error. We will need to improve the type conversion with round-to-nearest-even for example. Juan Fumero has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 22 commits: - [hat] abstracting the OpenCL and CUDA code builders - Merge branch 'code-reflection' into hat/type/bfloat16 - Merge branch 'code-reflection' into hat/type/bfloat16 - [hat] remove custom Op for bfloat - single line imports in hat code builders - single line imports in hat code builders - [hat] test matmul with bfloat16 - [hat] dialect for bfloat16 removed - [hat] new test file included in the hat test list - [hat] OpenCL handler for bfloat16 via float convs - ... and 12 more: https://git.openjdk.org/babylon/compare/0a7929cc...ddc932c3 ------------- Changes: https://git.openjdk.org/babylon/pull/716/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=716&range=01 Stats: 1620 lines in 28 files changed: 1463 ins; 76 del; 81 mod Patch: https://git.openjdk.org/babylon/pull/716.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/716/head:pull/716 PR: https://git.openjdk.org/babylon/pull/716 From gfrost at openjdk.org Wed Dec 3 12:12:41 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 3 Dec 2025 12:12:41 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v2] In-Reply-To: References: Message-ID: On Wed, 3 Dec 2025 11:53:56 GMT, Juan Fumero wrote: >> This PR introduces the type [`bfloat16`](https://cloud.google.com/blog/products/ai-machine-learning/bfloat16-the-secret-to-high-performance-on-cloud-tpus) for HAT. >> >> Testing for OpenCL: >> >> >> HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestBFloat16Type >> >> >> Testing for CUDA: >> >> >> HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-cuda hat.test.TestBFloat16Type >> >> >> Some tests are expecting to fail due to precision error. We will need to improve the type conversion with round-to-nearest-even for example. > > Juan Fumero has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 22 commits: > > - [hat] abstracting the OpenCL and CUDA code builders > - Merge branch 'code-reflection' into hat/type/bfloat16 > - Merge branch 'code-reflection' into hat/type/bfloat16 > - [hat] remove custom Op for bfloat > - single line imports in hat code builders > - single line imports in hat code builders > - [hat] test matmul with bfloat16 > - [hat] dialect for bfloat16 removed > - [hat] new test file included in the hat test list > - [hat] OpenCL handler for bfloat16 via float convs > - ... and 12 more: https://git.openjdk.org/babylon/compare/0a7929cc...ddc932c3 hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java line 97: > 95: } else if (javaType instanceof ClassType classType && classType.toClassName().equals(F16.class.getCanonicalName())) { > 96: // Check for special types (e.g., FP16) > 97: globalPtrPrefix().suffix_t(F16Impl.class.getSimpleName()).asterisk(); We might consider overloading suffix_t with suffix_t(Class clazz) which extracts the simpleName. T suffix_t(Class clazz){ return suffix_t(clazz.getSimpleNameI()); } Then we can just pass .suffix_t(F16Impl.class) ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2584866769 From gfrost at openjdk.org Wed Dec 3 12:26:55 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 3 Dec 2025 12:26:55 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v2] In-Reply-To: References: Message-ID: On Wed, 3 Dec 2025 11:53:56 GMT, Juan Fumero wrote: >> This PR introduces the type [`bfloat16`](https://cloud.google.com/blog/products/ai-machine-learning/bfloat16-the-secret-to-high-performance-on-cloud-tpus) for HAT. >> >> Testing for OpenCL: >> >> >> HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestBFloat16Type >> >> >> Testing for CUDA: >> >> >> HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-cuda hat.test.TestBFloat16Type >> >> >> Some tests are expecting to fail due to precision error. We will need to improve the type conversion with round-to-nearest-even for example. > > Juan Fumero has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 22 commits: > > - [hat] abstracting the OpenCL and CUDA code builders > - Merge branch 'code-reflection' into hat/type/bfloat16 > - Merge branch 'code-reflection' into hat/type/bfloat16 > - [hat] remove custom Op for bfloat > - single line imports in hat code builders > - single line imports in hat code builders > - [hat] test matmul with bfloat16 > - [hat] dialect for bfloat16 removed > - [hat] new test file included in the hat test list > - [hat] OpenCL handler for bfloat16 via float convs > - ... and 12 more: https://git.openjdk.org/babylon/compare/0a7929cc...ddc932c3 hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java line 316: > 314: byte f32Mixed = hatF16BinaryOp.getF32(); > 315: > 316: oparen(); you might consider leaning into paren($->$.generateReduceFloat....().) rather than balancing parenthesis yourself. hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java line 334: > 332: > 333: if (f32Mixed == HATF16BinaryOp.LAST_OP) { > 334: cparen(); Looks like separate executaionpaths here can create imbalanced paren? ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2584905562 PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2584909503 From jfumero at openjdk.org Wed Dec 3 13:40:38 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 3 Dec 2025 13:40:38 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v3] In-Reply-To: References: Message-ID: > This PR introduces the type [`bfloat16`](https://cloud.google.com/blog/products/ai-machine-learning/bfloat16-the-secret-to-high-performance-on-cloud-tpus) for HAT. > > Testing for OpenCL: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestBFloat16Type > > > Testing for CUDA: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-cuda hat.test.TestBFloat16Type > > > Some tests are expecting to fail due to precision error. We will need to improve the type conversion with round-to-nearest-even for example. Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: Use built-ins to process bfloat16 in the OpenCL backend ------------- Changes: - all: https://git.openjdk.org/babylon/pull/716/files - new: https://git.openjdk.org/babylon/pull/716/files/ddc932c3..df55159c Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=716&range=02 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=716&range=01-02 Stats: 118 lines in 3 files changed: 93 ins; 20 del; 5 mod Patch: https://git.openjdk.org/babylon/pull/716.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/716/head:pull/716 PR: https://git.openjdk.org/babylon/pull/716 From jfumero at openjdk.org Wed Dec 3 13:47:22 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 3 Dec 2025 13:47:22 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v2] In-Reply-To: References: Message-ID: <9FqDA6u6E-ykzhDTs3cAkijC-vacL7C5EzznxdlDvDs=.d426b224-51b8-4b10-ada5-39a0f2fb6784@github.com> On Wed, 3 Dec 2025 12:22:47 GMT, Gary Frost wrote: >> Juan Fumero has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 22 commits: >> >> - [hat] abstracting the OpenCL and CUDA code builders >> - Merge branch 'code-reflection' into hat/type/bfloat16 >> - Merge branch 'code-reflection' into hat/type/bfloat16 >> - [hat] remove custom Op for bfloat >> - single line imports in hat code builders >> - single line imports in hat code builders >> - [hat] test matmul with bfloat16 >> - [hat] dialect for bfloat16 removed >> - [hat] new test file included in the hat test list >> - [hat] OpenCL handler for bfloat16 via float convs >> - ... and 12 more: https://git.openjdk.org/babylon/compare/0a7929cc...ddc932c3 > > hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java line 316: > >> 314: byte f32Mixed = hatF16BinaryOp.getF32(); >> 315: >> 316: oparen(); > > you might consider leaning into paren($->$.generateReduceFloat....().) rather than balancing parenthesis yourself. Indeed. Thanks. > hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java line 334: > >> 332: >> 333: if (f32Mixed == HATF16BinaryOp.LAST_OP) { >> 334: cparen(); > > Looks like separate executaionpaths here can create imbalanced paren? The `generateReducedFloatConversionToFloat` already inserts an open parenthesis. I moved it out to make it explicit and avoid confusion. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2585175487 PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2585177940 From jfumero at openjdk.org Wed Dec 3 13:57:21 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 3 Dec 2025 13:57:21 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v4] In-Reply-To: References: Message-ID: > This PR introduces the type [`bfloat16`](https://cloud.google.com/blog/products/ai-machine-learning/bfloat16-the-secret-to-high-performance-on-cloud-tpus) for HAT. > > Testing for OpenCL: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestBFloat16Type > > > Testing for CUDA: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-cuda hat.test.TestBFloat16Type > > > Some tests are expecting to fail due to precision error. We will need to improve the type conversion with round-to-nearest-even for example. Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: [hat] bfloat16 codegen refactored ------------- Changes: - all: https://git.openjdk.org/babylon/pull/716/files - new: https://git.openjdk.org/babylon/pull/716/files/df55159c..22d0ef65 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=716&range=03 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=716&range=02-03 Stats: 37 lines in 4 files changed: 16 ins; 4 del; 17 mod Patch: https://git.openjdk.org/babylon/pull/716.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/716/head:pull/716 PR: https://git.openjdk.org/babylon/pull/716 From jfumero at openjdk.org Wed Dec 3 14:04:02 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 3 Dec 2025 14:04:02 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v5] In-Reply-To: References: Message-ID: > This PR introduces the type [`bfloat16`](https://cloud.google.com/blog/products/ai-machine-learning/bfloat16-the-secret-to-high-performance-on-cloud-tpus) for HAT. > > Testing for OpenCL: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestBFloat16Type > > > Testing for CUDA: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-cuda hat.test.TestBFloat16Type > > > Some tests are expecting to fail due to precision error. We will need to improve the type conversion with round-to-nearest-even for example. Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: [hat] fix builtin copyBytes ------------- Changes: - all: https://git.openjdk.org/babylon/pull/716/files - new: https://git.openjdk.org/babylon/pull/716/files/22d0ef65..b5dfe87f Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=716&range=04 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=716&range=03-04 Stats: 7 lines in 2 files changed: 3 ins; 3 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/716.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/716/head:pull/716 PR: https://git.openjdk.org/babylon/pull/716 From gfrost at openjdk.org Wed Dec 3 14:14:58 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 3 Dec 2025 14:14:58 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v4] In-Reply-To: References: Message-ID: <4nw6EV85OOJbhVhHRoMvseK1aWNxFNSYWzIepvi0vCo=.7da73169-b239-4089-9f79-5d8bce008205@github.com> On Wed, 3 Dec 2025 13:57:21 GMT, Juan Fumero wrote: >> This PR introduces the type [`bfloat16`](https://cloud.google.com/blog/products/ai-machine-learning/bfloat16-the-secret-to-high-performance-on-cloud-tpus) for HAT. >> >> Testing for OpenCL: >> >> >> HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestBFloat16Type >> >> >> Testing for CUDA: >> >> >> HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-cuda hat.test.TestBFloat16Type >> >> >> Some tests are expecting to fail due to precision error. We will need to improve the type conversion with round-to-nearest-even for example. > > Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: > > [hat] bfloat16 codegen refactored hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java line 126: > 124: if (OpTk.isAssignable(buildContext.lookup, javaType, MappableIface.class) && javaType instanceof ClassType classType) { > 125: globalPtrPrefix().suffix_t(classType).asterisk(); > 126: } else if (javaType instanceof ClassType classType && classType.toClassName().equals(F16.class.getCanonicalName())) { Can we leverage OpTk.isAssignable ? or at least avoid string comparisons on Class.getCanonicalName Something like OpTK.isAssignable(lookup, classType, F16.class) ? I think we have access to the lookup in the context... hat/core/src/main/java/hat/codebuilders/HATCodeBuilder.java line 84: > 82: } > 83: > 84: public T suffix_t(Class klass) { Can we compose using existing methods? return suffix_t(class.getSimpleName()); hat/core/src/main/java/hat/codebuilders/HATCodeBuilder.java line 89: > 87: > 88: public T suffix_u(Class klass) { > 89: return identifier(klass.getSimpleName()).identifier("_u"); Same as above ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2585272419 PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2585257810 PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2585259258 From gfrost at openjdk.org Wed Dec 3 14:14:59 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 3 Dec 2025 14:14:59 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v4] In-Reply-To: <4nw6EV85OOJbhVhHRoMvseK1aWNxFNSYWzIepvi0vCo=.7da73169-b239-4089-9f79-5d8bce008205@github.com> References: <4nw6EV85OOJbhVhHRoMvseK1aWNxFNSYWzIepvi0vCo=.7da73169-b239-4089-9f79-5d8bce008205@github.com> Message-ID: On Wed, 3 Dec 2025 14:08:37 GMT, Gary Frost wrote: >> Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: >> >> [hat] bfloat16 codegen refactored > > hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java line 126: > >> 124: if (OpTk.isAssignable(buildContext.lookup, javaType, MappableIface.class) && javaType instanceof ClassType classType) { >> 125: globalPtrPrefix().suffix_t(classType).asterisk(); >> 126: } else if (javaType instanceof ClassType classType && classType.toClassName().equals(F16.class.getCanonicalName())) { > > Can we leverage OpTk.isAssignable ? or at least avoid string comparisons on Class.getCanonicalName > > Something like > OpTK.isAssignable(lookup, classType, F16.class) ? > > I think we have access to the lookup in the context... Actually if you check for DeviceType... you might be able to collapse multiple else ifs... here }else if (javaType instanceof ClassType classType && OpTk.isAssignable(javaType,DeviceType.class){ .... generate the typedef ... } ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2585283414 From gfrost at openjdk.org Wed Dec 3 14:18:03 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 3 Dec 2025 14:18:03 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v2] In-Reply-To: <9FqDA6u6E-ykzhDTs3cAkijC-vacL7C5EzznxdlDvDs=.d426b224-51b8-4b10-ada5-39a0f2fb6784@github.com> References: <9FqDA6u6E-ykzhDTs3cAkijC-vacL7C5EzznxdlDvDs=.d426b224-51b8-4b10-ada5-39a0f2fb6784@github.com> Message-ID: On Wed, 3 Dec 2025 13:45:07 GMT, Juan Fumero wrote: >> hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java line 334: >> >>> 332: >>> 333: if (f32Mixed == HATF16BinaryOp.LAST_OP) { >>> 334: cparen(); >> >> Looks like separate executaionpaths here can create imbalanced paren? > > The `generateReducedFloatConversionToFloat` already inserts an open parenthesis. I moved it out to make it explicit and avoid confusion. Ah yes, we should avoid having paranthesis imbalances generated by helper methods. Pulling the oparen() (as you did here) out to the top level makes this more explict. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2585297758 From jfumero at openjdk.org Wed Dec 3 15:03:48 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 3 Dec 2025 15:03:48 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v6] In-Reply-To: References: Message-ID: > This PR introduces the type [`bfloat16`](https://cloud.google.com/blog/products/ai-machine-learning/bfloat16-the-secret-to-high-performance-on-cloud-tpus) for HAT. > > Testing for OpenCL: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestBFloat16Type > > > Testing for CUDA: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-cuda hat.test.TestBFloat16Type > > > Some tests are expecting to fail due to precision error. We will need to improve the type conversion with round-to-nearest-even for example. Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: [hat] DeviceTypes control for the dialect and codegen simplified ------------- Changes: - all: https://git.openjdk.org/babylon/pull/716/files - new: https://git.openjdk.org/babylon/pull/716/files/b5dfe87f..e672cd0f Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=716&range=05 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=716&range=04-05 Stats: 147 lines in 13 files changed: 69 ins; 55 del; 23 mod Patch: https://git.openjdk.org/babylon/pull/716.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/716/head:pull/716 PR: https://git.openjdk.org/babylon/pull/716 From jfumero at openjdk.org Wed Dec 3 15:24:55 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 3 Dec 2025 15:24:55 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v4] In-Reply-To: References: <4nw6EV85OOJbhVhHRoMvseK1aWNxFNSYWzIepvi0vCo=.7da73169-b239-4089-9f79-5d8bce008205@github.com> Message-ID: On Wed, 3 Dec 2025 14:11:51 GMT, Gary Frost wrote: >> hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java line 126: >> >>> 124: if (OpTk.isAssignable(buildContext.lookup, javaType, MappableIface.class) && javaType instanceof ClassType classType) { >>> 125: globalPtrPrefix().suffix_t(classType).asterisk(); >>> 126: } else if (javaType instanceof ClassType classType && classType.toClassName().equals(F16.class.getCanonicalName())) { >> >> Can we leverage OpTk.isAssignable ? or at least avoid string comparisons on Class.getCanonicalName >> >> Something like >> OpTK.isAssignable(lookup, classType, F16.class) ? >> >> I think we have access to the lookup in the context... > > Actually if you check for DeviceType... you might be able to collapse multiple else ifs... here > > }else if (javaType instanceof ClassType classType && OpTk.isAssignable(javaType,DeviceType.class){ > .... generate the typedef ... > } We need to design a better strategy here. The problem is not that much about the String comparison, but the array implementation (e.g., `F16Impl`. What we could do is to add new Ops in the dialect to handle this case and make it generic, and we could avoid completely these comparisons. I prefer to have a separate PR for this. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2585550861 From jfumero at openjdk.org Wed Dec 3 15:31:02 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 3 Dec 2025 15:31:02 GMT Subject: [code-reflection] RFR: [hat] Proposal for bfloat16 [v7] In-Reply-To: References: Message-ID: > This PR introduces the type [`bfloat16`](https://cloud.google.com/blog/products/ai-machine-learning/bfloat16-the-secret-to-high-performance-on-cloud-tpus) for HAT. > > Testing for OpenCL: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestBFloat16Type > > > Testing for CUDA: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-cuda hat.test.TestBFloat16Type > > > Some tests are expecting to fail due to precision error. We will need to improve the type conversion with round-to-nearest-even for example. Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: [hat] type-class builders reused ------------- Changes: - all: https://git.openjdk.org/babylon/pull/716/files - new: https://git.openjdk.org/babylon/pull/716/files/e672cd0f..a592e4b6 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=716&range=06 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=716&range=05-06 Stats: 4 lines in 1 file changed: 0 ins; 1 del; 3 mod Patch: https://git.openjdk.org/babylon/pull/716.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/716/head:pull/716 PR: https://git.openjdk.org/babylon/pull/716 From jfumero at openjdk.org Wed Dec 3 16:49:29 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 3 Dec 2025 16:49:29 GMT Subject: git: openjdk/babylon: code-reflection: [hat] Proposal for bfloat16 Message-ID: <711031a5-df5f-4d25-a3c6-e247aeab1e04@openjdk.org> Changeset: dedbd84e Branch: code-reflection Author: Juan Fumero Date: 2025-12-03 16:46:22 +0000 URL: https://git.openjdk.org/babylon/commit/dedbd84edeed30a5e2b3993bc1c6aee43231340e [hat] Proposal for bfloat16 ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLHATKernelBuilder.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/core/src/main/java/hat/BufferTagger.java + hat/core/src/main/java/hat/buffer/BF16.java + hat/core/src/main/java/hat/buffer/BF16Array.java ! hat/core/src/main/java/hat/buffer/F16.java = hat/core/src/main/java/hat/buffer/HAType.java ! hat/core/src/main/java/hat/codebuilders/BabylonOpBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/CodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilderWithContext.java ! hat/core/src/main/java/hat/dialect/HATF16AddOp.java ! hat/core/src/main/java/hat/dialect/HATF16BinaryOp.java ! hat/core/src/main/java/hat/dialect/HATF16ConvOp.java ! hat/core/src/main/java/hat/dialect/HATF16DivOp.java ! hat/core/src/main/java/hat/dialect/HATF16MulOp.java ! hat/core/src/main/java/hat/dialect/HATF16Op.java ! hat/core/src/main/java/hat/dialect/HATF16SubOp.java ! hat/core/src/main/java/hat/dialect/HATF16ToFloatConvOp.java ! hat/core/src/main/java/hat/dialect/HATF16VarOp.java ! hat/core/src/main/java/hat/dialect/HATPhaseUtils.java + hat/core/src/main/java/hat/dialect/ReducedFloatType.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/phases/HATDialect.java ! hat/core/src/main/java/hat/phases/HATDialectifyFP16Phase.java ! hat/core/src/main/java/hat/phases/HATDialectifyMemoryPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorOpPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorSelectPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorStorePhase.java ! hat/core/src/main/java/hat/phases/HATFinalDetectionPhase.java ! hat/hat/test.java + hat/tests/src/main/java/hat/test/TestBFloat16Type.java ! hat/tests/src/main/java/hat/test/TestF16Type.java ! hat/tests/src/main/java/hat/test/TestMatMul.java ! hat/tools/src/main/java/hat/tools/text/JavaHATCodeBuilder.java From jfumero at openjdk.org Wed Dec 3 16:49:37 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 3 Dec 2025 16:49:37 GMT Subject: [code-reflection] Integrated: [hat] Proposal for bfloat16 In-Reply-To: References: Message-ID: On Fri, 28 Nov 2025 15:18:43 GMT, Juan Fumero wrote: > This PR introduces the type [`bfloat16`](https://cloud.google.com/blog/products/ai-machine-learning/bfloat16-the-secret-to-high-performance-on-cloud-tpus) for HAT. > > Testing for OpenCL: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestBFloat16Type > > > Testing for CUDA: > > > HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-cuda hat.test.TestBFloat16Type > > > Some tests are expecting to fail due to precision error. We will need to improve the type conversion with round-to-nearest-even for example. This pull request has now been integrated. Changeset: dedbd84e Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/dedbd84edeed30a5e2b3993bc1c6aee43231340e Stats: 1848 lines in 37 files changed: 1611 ins; 126 del; 111 mod [hat] Proposal for bfloat16 ------------- PR: https://git.openjdk.org/babylon/pull/716 From mcimadamore at openjdk.org Wed Dec 3 17:47:37 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Wed, 3 Dec 2025 17:47:37 GMT Subject: [code-reflection] RFR: Fix issues with local class creation from reflectable constructs Message-ID: Instantiation of local class from reflectable methods/lambdas is generally supported (although we do not support code reflection on local class members themselves). However, when testing I found there are many gaps in the current story: * existing support works or not depending on _where_ the local class is defined * when the local class to create contains its own captures, and the local class is inside a lambda expression, we just fail with `UnsupportedOperationException` (!!) * when a lambda tries to allocate a local class that was declared outside the lambda, the lambda code has no idea of which captures should come with the local class * when a lambda tries to allocate a regular member inner class with an implicit enclosing `this`, the lambda itself is not marked as capturing `this`, so model generation fails I addressed (I hope :-) ) all the above issues, and added several tests to check correctness. The main fix is to share the code to compute the local captures associated with a local class. We should compute such captures whenever we see a class declaration, both in `ReflectMethods` and in all its companion visitors -- otherwise the risk is that we will run some code that will require knowledge of the local class capture, but such knowledge is not available yet. ------------- Commit messages: - Only compute local var captures if not already computed - Initial push Changes: https://git.openjdk.org/babylon/pull/723/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=723&range=00 Stats: 169 lines in 2 files changed: 147 ins; 17 del; 5 mod Patch: https://git.openjdk.org/babylon/pull/723.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/723/head:pull/723 PR: https://git.openjdk.org/babylon/pull/723 From gfrost at openjdk.org Wed Dec 3 19:01:49 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 3 Dec 2025 19:01:49 GMT Subject: [code-reflection] Integrated: Simplify C99 codegen Message-ID: <4P9yItOR2o9OMsxape0p3UC8prlQWkKK20xQFm7Rnfg=.e574c598-72c9-4be9-8437-e1c4c93bfe32@github.com> Some simplification of codegen by building common helpers. ------------- Commit messages: - Simplify C99 codegen Changes: https://git.openjdk.org/babylon/pull/724/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=724&range=00 Stats: 115 lines in 6 files changed: 64 ins; 5 del; 46 mod Patch: https://git.openjdk.org/babylon/pull/724.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/724/head:pull/724 PR: https://git.openjdk.org/babylon/pull/724 From gfrost at openjdk.org Wed Dec 3 19:01:50 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 3 Dec 2025 19:01:50 GMT Subject: [code-reflection] Integrated: Simplify C99 codegen In-Reply-To: <4P9yItOR2o9OMsxape0p3UC8prlQWkKK20xQFm7Rnfg=.e574c598-72c9-4be9-8437-e1c4c93bfe32@github.com> References: <4P9yItOR2o9OMsxape0p3UC8prlQWkKK20xQFm7Rnfg=.e574c598-72c9-4be9-8437-e1c4c93bfe32@github.com> Message-ID: On Wed, 3 Dec 2025 18:55:23 GMT, Gary Frost wrote: > Some simplification of codegen by building common helpers. This pull request has now been integrated. Changeset: 398893b3 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/398893b37edab24e5da46acb2f76f6ebe1fe1f7a Stats: 115 lines in 6 files changed: 64 ins; 5 del; 46 mod Simplify C99 codegen ------------- PR: https://git.openjdk.org/babylon/pull/724 From psandoz at openjdk.org Wed Dec 3 19:01:26 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 3 Dec 2025 19:01:26 GMT Subject: [code-reflection] RFR: Fix issues with local class creation from reflectable constructs In-Reply-To: References: Message-ID: On Wed, 3 Dec 2025 17:42:11 GMT, Maurizio Cimadamore wrote: > Instantiation of local class from reflectable methods/lambdas is generally supported (although we do not support code reflection on local class members themselves). > > However, when testing I found there are many gaps in the current story: > > * existing support works or not depending on _where_ the local class is defined > * when the local class to create contains its own captures, and the local class is inside a lambda expression, we just fail with `UnsupportedOperationException` (!!) > * when a lambda tries to allocate a local class that was declared outside the lambda, the lambda code has no idea of which captures should come with the local class > * when a lambda tries to allocate a regular member inner class with an implicit enclosing `this`, the lambda itself is not marked as capturing `this`, so model generation fails > > I addressed (I hope :-) ) all the above issues, and added several tests to check correctness. > > The main fix is to share the code to compute the local captures associated with a local class. We should compute such captures whenever we see a class declaration, both in `ReflectMethods` and in all its companion visitors -- otherwise the risk is that we will run some code that will require knowledge of the local class capture, but such knowledge is not available yet. Looks good, nice tests. Marked as reviewed by psandoz (Lead). ------------- PR Review: https://git.openjdk.org/babylon/pull/723#pullrequestreview-3536476352 PR Review: https://git.openjdk.org/babylon/pull/723#pullrequestreview-3536477101 From gfrost at openjdk.org Wed Dec 3 19:04:48 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 3 Dec 2025 19:04:48 GMT Subject: git: openjdk/babylon: code-reflection: Simplify C99 codegen Message-ID: <24894afb-0474-4666-b154-5e58abd27fd0@openjdk.org> Changeset: 398893b3 Branch: code-reflection Author: Gary Frost Date: 2025-12-03 18:58:02 +0000 URL: https://git.openjdk.org/babylon/commit/398893b37edab24e5da46acb2f76f6ebe1fe1f7a Simplify C99 codegen ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLHATKernelBuilder.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/CodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilderWithContext.java From duke at openjdk.org Wed Dec 3 20:31:59 2025 From: duke at openjdk.org (Ruby Chen) Date: Wed, 3 Dec 2025 20:31:59 GMT Subject: [code-reflection] RFR: ModuleOp generation from LambdaOp and FuncOp [v5] In-Reply-To: References: Message-ID: <2q5_UdNNOpwOFE7v3LV-8XnafOLnq1AueLk0urh2idk=.568636b9-655b-4202-9404-b1b8bc7fdeba@github.com> > Add support for generating a ModuleOp from either a LambdaOp or a FuncOp. The given LambdaOp will be converted into the root FuncOp, and the given FuncOp will be assigned as the root FuncOp. > > For `CoreOp.ModuleOp.ofLambdaOp()`, a unique name for the new root FuncOp must be passed as a parameter. Ruby Chen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision: - Add tests - Merge branch 'openjdk:code-reflection' into module-op-support - removing commented code - Suggested changes - Merge branch 'openjdk:code-reflection' into module-op-support - Merge branch 'openjdk:code-reflection' into module-op-support - Update src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/core/CoreOp.java Co-authored-by: Paul Sandoz - ModuleOp generation from LambdaOp and FuncOp ------------- Changes: - all: https://git.openjdk.org/babylon/pull/691/files - new: https://git.openjdk.org/babylon/pull/691/files/74910c50..ad4bc853 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=691&range=04 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=691&range=03-04 Stats: 4533 lines in 93 files changed: 3503 ins; 669 del; 361 mod Patch: https://git.openjdk.org/babylon/pull/691.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/691/head:pull/691 PR: https://git.openjdk.org/babylon/pull/691 From mcimadamore at openjdk.org Wed Dec 3 22:14:50 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Wed, 3 Dec 2025 22:14:50 GMT Subject: git: openjdk/babylon: code-reflection: Fix issues with local class creation from reflectable constructs Message-ID: Changeset: eff881e1 Branch: code-reflection Author: Maurizio Cimadamore Date: 2025-12-03 22:13:57 +0000 URL: https://git.openjdk.org/babylon/commit/eff881e1f9c145823340f01e30d1262db94122e4 Fix issues with local class creation from reflectable constructs Reviewed-by: psandoz ! src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java ! test/langtools/tools/javac/reflect/LocalClassTest.java From mcimadamore at openjdk.org Wed Dec 3 22:16:27 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Wed, 3 Dec 2025 22:16:27 GMT Subject: [code-reflection] Integrated: Fix issues with local class creation from reflectable constructs In-Reply-To: References: Message-ID: On Wed, 3 Dec 2025 17:42:11 GMT, Maurizio Cimadamore wrote: > Instantiation of local class from reflectable methods/lambdas is generally supported (although we do not support code reflection on local class members themselves). > > However, when testing I found there are many gaps in the current story: > > * existing support works or not depending on _where_ the local class is defined > * when the local class to create contains its own captures, and the local class is inside a lambda expression, we just fail with `UnsupportedOperationException` (!!) > * when a lambda tries to allocate a local class that was declared outside the lambda, the lambda code has no idea of which captures should come with the local class > * when a lambda tries to allocate a regular member inner class with an implicit enclosing `this`, the lambda itself is not marked as capturing `this`, so model generation fails > > I addressed (I hope :-) ) all the above issues, and added several tests to check correctness. > > The main fix is to share the code to compute the local captures associated with a local class. We should compute such captures whenever we see a class declaration, both in `ReflectMethods` and in all its companion visitors -- otherwise the risk is that we will run some code that will require knowledge of the local class capture, but such knowledge is not available yet. This pull request has now been integrated. Changeset: eff881e1 Author: Maurizio Cimadamore URL: https://git.openjdk.org/babylon/commit/eff881e1f9c145823340f01e30d1262db94122e4 Stats: 169 lines in 2 files changed: 147 ins; 17 del; 5 mod Fix issues with local class creation from reflectable constructs Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/723 From jfumero at openjdk.org Thu Dec 4 10:02:46 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Thu, 4 Dec 2025 10:02:46 GMT Subject: [code-reflection] RFR: [hat] bfloat16 codegen for C99 conversion fixed Message-ID: [hat] bfloat16 codegen for C99 conversion fixed ------------- Commit messages: - [hat] bfloat16 codegen for C99 conversion fixed Changes: https://git.openjdk.org/babylon/pull/725/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=725&range=00 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/725.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/725/head:pull/725 PR: https://git.openjdk.org/babylon/pull/725 From jfumero at openjdk.org Thu Dec 4 10:07:34 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Thu, 4 Dec 2025 10:07:34 GMT Subject: [code-reflection] Integrated: [hat] bfloat16 codegen for C99 conversion fixed In-Reply-To: References: Message-ID: <4Jt1T62wX9C-xKqLqExIdO8YV4sgIkHvgA07Ffb3d4A=.002ca1be-2784-499f-a952-d9e68d346838@github.com> On Thu, 4 Dec 2025 09:57:53 GMT, Juan Fumero wrote: > [hat] bfloat16 codegen for C99 conversion fixed This pull request has now been integrated. Changeset: d5fff759 Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/d5fff759a1257af70d648e3ae006edb3a39ed63d Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod [hat] bfloat16 codegen for C99 conversion fixed ------------- PR: https://git.openjdk.org/babylon/pull/725 From jfumero at openjdk.org Thu Dec 4 10:08:39 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Thu, 4 Dec 2025 10:08:39 GMT Subject: git: openjdk/babylon: code-reflection: [hat] bfloat16 codegen for C99 conversion fixed Message-ID: <50162458-30e4-4f28-a7da-7ff9f3f62b51@openjdk.org> Changeset: d5fff759 Branch: code-reflection Author: Juan Fumero Date: 2025-12-04 10:04:24 +0000 URL: https://git.openjdk.org/babylon/commit/d5fff759a1257af70d648e3ae006edb3a39ed63d [hat] bfloat16 codegen for C99 conversion fixed ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilder.java From asotona at openjdk.org Thu Dec 4 13:27:56 2025 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 4 Dec 2025 13:27:56 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v14] In-Reply-To: References: Message-ID: > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. > > Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. > > Lowering of `BreakOp`, `SwitchFallthroughOp` and nested switches will be implemented in a follow-up PR. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: - Merge remote-tracking branch 'asotona/bytecodegenerator-cleanup' into bytecodegenerator-cleanup - Fix JavaSwitchOp.lower to correctly lower regardless of where default case appears ------------- Changes: - all: https://git.openjdk.org/babylon/pull/706/files - new: https://git.openjdk.org/babylon/pull/706/files/811f061a..82c75258 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=13 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=706&range=12-13 Stats: 105 lines in 1 file changed: 65 ins; 32 del; 8 mod Patch: https://git.openjdk.org/babylon/pull/706.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/706/head:pull/706 PR: https://git.openjdk.org/babylon/pull/706 From mcimadamore at openjdk.org Thu Dec 4 13:43:47 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 4 Dec 2025 13:43:47 GMT Subject: [code-reflection] RFR: Make @Reflect a use-site annotation Message-ID: In the current iteration of compiler support there are two ways to make a lambda reflectable: 1. cast the lambda to a type that is annotated with the `@Reflect` annotation (use-site) 2. pass the lambda to a functional interface whose declaration is annotated with `@Reflect` (decl-site) While (2) is handy in cases where the library wants to control reflectability of the lambdas it receives, this model is too weak and insecure, as it might lead to unknowing clients exposing private impl details with frameworks using code reflection. For this reason, we have revamped the `@Reflect` annotation to control, at the use-site, which program elements should support code reflection: * If a method is annotated with `@Reflect`, the method itself is reflectable, and all the lambdas it contains are reflectable; * If a field/local variable is annotated with `@Reflect`, all the lambdas that occur inside the initializer (if present), are reflectable; * If a cast type is annotated with `@Reflect` and the cast is applied to a lambda expression, that lambda expression is reflectable (this is the same as (1) above). This means it's no longer possible for a library to create a reflectable functional interface, like: @Reflect interface ReflectableRunnable extends Runnable { } And unilaterally decide, for _all_ clients whether their lambdas should be reflectable. To be clear, this is **not** how things will work longer term, but it's an interim step which provides the desired level of safety w/o requiring the additional language features. I've fixed all tests. I've tried to simplify both javac and JDK tests by dropping redundant functional interface declarations. I also fixed all the samples; for ONNX some tweaks were done, and I've decided to drop the OnnxFunction -- and to use a supplier instead. But if that's not desirable I can change back (or it can be changed back later). I also fixed HAT tests -- in that case it was a bit trickier, as there's lots of tests that end up passing reflectable lambdas to the HAT's compute method. Luckily, all these tests are annotated with `@HatTest`, so I've simply added an extra `@Reflect` to any such test method. Since `@Reflect` now propagates to the body, this guarantees that all the lambdas inside these test methods are treated as reflectable. Of course these HAT change end up enabling reflection for a lot more than it's required. I'll leave it to people more expert with HAT to clean that up, if needed. In the meantime, it was useful to run in this mode, as that uncovered 2 separate issues in the compiler support, one in this PR (default methods were no longer being treated as reflectable) and another pre-existing (compiler crashed when encountering package names in qualified names). ------------- Commit messages: - Fix diags - Fix hat tests - Fix tests - Merge branch 'code-reflection' into better_annos - Initial push - Initial push Changes: https://git.openjdk.org/babylon/pull/726/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=726&range=00 Stats: 981 lines in 52 files changed: 281 ins; 575 del; 125 mod Patch: https://git.openjdk.org/babylon/pull/726.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/726/head:pull/726 PR: https://git.openjdk.org/babylon/pull/726 From mcimadamore at openjdk.org Thu Dec 4 13:43:52 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 4 Dec 2025 13:43:52 GMT Subject: [code-reflection] RFR: Make @Reflect a use-site annotation In-Reply-To: References: Message-ID: On Thu, 4 Dec 2025 13:27:57 GMT, Maurizio Cimadamore wrote: > In the current iteration of compiler support there are two ways to make a lambda reflectable: > 1. cast the lambda to a type that is annotated with the `@Reflect` annotation (use-site) > 2. pass the lambda to a functional interface whose declaration is annotated with `@Reflect` (decl-site) > > While (2) is handy in cases where the library wants to control reflectability of the lambdas it receives, this model is too weak and insecure, as it might lead to unknowing clients exposing private impl details with frameworks using code reflection. > > For this reason, we have revamped the `@Reflect` annotation to control, at the use-site, which program elements should support code reflection: > > * If a method is annotated with `@Reflect`, the method itself is reflectable, and all the lambdas it contains are reflectable; > * If a field/local variable is annotated with `@Reflect`, all the lambdas that occur inside the initializer (if present), are reflectable; > * If a cast type is annotated with `@Reflect` and the cast is applied to a lambda expression, that lambda expression is reflectable (this is the same as (1) above). > > This means it's no longer possible for a library to create a reflectable functional interface, like: > > > @Reflect > interface ReflectableRunnable extends Runnable { } > > > And unilaterally decide, for _all_ clients whether their lambdas should be reflectable. > > To be clear, this is **not** how things will work longer term, but it's an interim step which provides the desired level of safety w/o requiring the additional language features. > > I've fixed all tests. I've tried to simplify both javac and JDK tests by dropping redundant functional interface declarations. > > I also fixed all the samples; for ONNX some tweaks were done, and I've decided to drop the OnnxFunction -- and to use a supplier instead. But if that's not desirable I can change back (or it can be changed back later). > > I also fixed HAT tests -- in that case it was a bit trickier, as there's lots of tests that end up passing reflectable lambdas to the HAT's compute method. Luckily, all these tests are annotated with `@HatTest`, so I've simply added an extra `@Reflect` to any such test method. Since `@Reflect` now propagates to the body, this guarantees that all the lambdas inside these test methods are treated as reflectable. > > Of course these HAT change end up enabling reflection for a lot more than it's required. I'll leave it to people more expert with HAT to clean that up, if needed. > In the meantime, it was ... src/jdk.incubator.code/share/classes/jdk/incubator/code/Reflect.java line 32: > 30: > 31: /** > 32: * A program element annotated with this annotation enables code reflection in the annotated program element, I've tried to describe a bit more formally how the annotation is supposed to behave -- @PaulSandoz please take a look. src/jdk.incubator.code/share/classes/jdk/incubator/code/Reflect.java line 49: > 47: * > 48: */ > 49: @Target({ElementType.LOCAL_VARIABLE, ElementType.FIELD, One thing I realized: when we made this a type annotation, now you can also use `@Reflect` on classes and constructors as well -- because in those cases the annotation is reinterpreted as a type annotation (ugly, I know) -- and so it will be silently ignored. One alternative would be to drop the annotated cast and just rely on local variable decl annotations, but I didn't want to go there w/o first asking. src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java line 330: > 328: if (currentClassSym.type.getEnclosingType().hasTag(CLASS)) { > 329: // Reflectable method references in local classes are not supported > 330: log.warning(tree, ReflectableMrefInnerClass(currentClassSym.enclClass())); Note: this is no longer an error -- otherwise we'd get errors for any reflectable method that contains local classes with some methods. src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java line 1036: > 1034: } > 1035: } > 1036: case PACKAGE, INTERFACE, CLASS, RECORD, ENUM -> { This is a pre-existing issue -- e.g. calling `println` with a fully qualified name, like `java.lang.System.out.println` causes an exception, because we eventually visit `java` and `java.lang` which are packages src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java line 1499: > 1497: JavaType fiType = typeToTypeElement(tree.target); > 1498: // build functional lambda > 1499: Op lambdaOp = JavaOp.lambda(fiType, stack.body, true); Note: now _all_ lambdas we encounter when scanning a reflectable body are (by definition) quotable. This means that in several tests, the `isQuotable` attribute now shows up as `true` everywhere. And, in the JDK bytecode tests there is no longer a way to test that support for non-reflectable lambdas works correctly (so I dropped some tests there). test/jdk/java/lang/reflect/code/bytecode/lift/TestBytecodeLift.java line 372: > 370: } > 371: > 372: static int consumeQuotable(int i, IntUnaryOperator f) { Note: all lambdas nested inside a `@Reflect` method are reflectable now, so it's no longer possible (I think) to test lifting of non-reflectable lambdas. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/726#discussion_r2589109180 PR Review Comment: https://git.openjdk.org/babylon/pull/726#discussion_r2589116428 PR Review Comment: https://git.openjdk.org/babylon/pull/726#discussion_r2589120431 PR Review Comment: https://git.openjdk.org/babylon/pull/726#discussion_r2589097043 PR Review Comment: https://git.openjdk.org/babylon/pull/726#discussion_r2589126947 PR Review Comment: https://git.openjdk.org/babylon/pull/726#discussion_r2589130474 From asotona at openjdk.org Thu Dec 4 14:22:40 2025 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 4 Dec 2025 14:22:40 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v14] In-Reply-To: References: Message-ID: On Thu, 4 Dec 2025 13:27:56 GMT, Adam Sotona wrote: >> The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. >> >> The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. >> >> A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. >> >> Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. >> >> Lowering of `BreakOp`, `SwitchFallthroughOp` and nested switches will be implemented in a follow-up PR. >> >> This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. > > Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: > > - Merge remote-tracking branch 'asotona/bytecodegenerator-cleanup' into bytecodegenerator-cleanup > - Fix JavaSwitchOp.lower to correctly lower regardless of where default case appears @mabbay Nice fix of the default case lowering. @mcimadamore I think the detection of the default case body by the constant `true` is good enough for now and we may refine it later as needed (either by a custom `DefaultLabelOp`, or by storing its index into an attribute, or any other way). ------------- PR Comment: https://git.openjdk.org/babylon/pull/706#issuecomment-3612492347 From asotona at openjdk.org Thu Dec 4 14:26:57 2025 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 4 Dec 2025 14:26:57 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v14] In-Reply-To: References: Message-ID: On Thu, 4 Dec 2025 13:27:56 GMT, Adam Sotona wrote: >> The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. >> >> The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. >> >> A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. >> >> Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. >> >> Lowering of `BreakOp`, `SwitchFallthroughOp` and nested switches will be implemented in a follow-up PR. >> >> This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. > > Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: > > - Merge remote-tracking branch 'asotona/bytecodegenerator-cleanup' into bytecodegenerator-cleanup > - Fix JavaSwitchOp.lower to correctly lower regardless of where default case appears src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java line 2846: > 2844: > 2845: for (int i = 0; i < bodies().size(); i+=2) { > 2846: if (i == defLabelIndex) { I was thinking this would break the physical body blocks order, however they are allocated early and the order is correct. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/706#discussion_r2589292172 From asotona at openjdk.org Thu Dec 4 15:02:43 2025 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 4 Dec 2025 15:02:43 GMT Subject: [code-reflection] RFR: BytecodeGenerator cleanup and switch support [v14] In-Reply-To: References: Message-ID: On Thu, 4 Dec 2025 13:27:56 GMT, Adam Sotona wrote: >> The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. >> >> The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. >> >> A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. >> >> Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. >> >> Lowering of `BreakOp`, `SwitchFallthroughOp` and nested switches has been implemented in this PR. >> >> The PR also fixes standard lowering of `SwitchStatementOp` with default case fall-through. >> >> This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. > > Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: > > - Merge remote-tracking branch 'asotona/bytecodegenerator-cleanup' into bytecodegenerator-cleanup > - Fix JavaSwitchOp.lower to correctly lower regardless of where default case appears Thank you for all the reviews. Unresolved comments will be solved in a follow-up PR. ------------- PR Comment: https://git.openjdk.org/babylon/pull/706#issuecomment-3612669716 From gfrost at openjdk.org Thu Dec 4 15:10:18 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 4 Dec 2025 15:10:18 GMT Subject: git: openjdk/babylon: code-reflection: 2 new changesets Message-ID: <0bf2b10f-53c2-4c08-b9b6-b57ebdd9f63e@openjdk.org> Changeset: 832efca9 Branch: code-reflection Author: Adam Sotona Date: 2025-12-04 15:07:10 +0000 URL: https://git.openjdk.org/babylon/commit/832efca9d9e2769118226c532af5e2fc17eb8ba5 BytecodeGenerator cleanup and switch support Co-authored-by: Mourad Abbay ! src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/BytecodeGenerator.java + src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/impl/ConstantLabelSwitchOp.java + src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/impl/ExceptionTableCompactor.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/impl/LocalsCompactor.java + src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/impl/LoweringTransform.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java + src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/BranchTarget.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/OpBuilder.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java ! test/jdk/java/lang/reflect/code/bytecode/TestArrayCreation.java ! test/jdk/java/lang/reflect/code/bytecode/TestBytecode.java ! test/jdk/java/lang/reflect/code/bytecode/TestInvokeSuper.java + test/jdk/java/lang/reflect/code/bytecode/TestIsCaseConstantSwitch.java ! test/jdk/java/lang/reflect/code/bytecode/TestNestedCapturingLambda.java ! test/jdk/java/lang/reflect/code/bytecode/TestSlots.java + test/jdk/java/lang/reflect/code/bytecode/TestSwitch.java ! test/jdk/java/lang/reflect/code/bytecode/TestSynchronizedOp.java ! test/jdk/java/lang/reflect/code/bytecode/TestTry.java ! test/jdk/java/lang/reflect/code/bytecode/TestTryFinally.java ! test/jdk/java/lang/reflect/code/bytecode/TestTryFinallyNested.java ! test/jdk/java/lang/reflect/code/bytecode/TestVarArg.java ! test/jdk/java/lang/reflect/code/writer/TestCodeBuilder.java ! test/langtools/tools/javac/reflect/SwitchExpressionTest2.java ! test/langtools/tools/javac/reflect/SwitchStatementTest.java Changeset: 2a5d7e13 Branch: code-reflection Author: Gary Frost Date: 2025-12-04 15:09:10 +0000 URL: https://git.openjdk.org/babylon/commit/2a5d7e1387f21c62f5b0861cbf52c3cd7a5f1040 Job builder was dropping javac jvmopts ! hat/env.bash ! hat/hat/job.jar ! hat/hat/job/src/main/java/job/Jar.java From asotona at openjdk.org Thu Dec 4 15:12:46 2025 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 4 Dec 2025 15:12:46 GMT Subject: [code-reflection] Integrated: BytecodeGenerator cleanup and switch support In-Reply-To: References: Message-ID: On Tue, 25 Nov 2025 14:23:19 GMT, Adam Sotona wrote: > The current `BytecodeGenerator` implementation assumes that code models have already been lowered before generation. Both `SwitchExpressionOp` and `SwitchStatementOp` with all-constant labels are examples of operations that can be lowered an alternative way, allowing `BytecodeGenerator` to produce more efficient bytecode using `tableswitch` and `lookupswitch` instructions. > > The proposed change shifts the responsibility for lowering these operations into the `BytecodeGenerator` itself, enabling selective lowering during bytecode generation. Consequently, `OpBuilder` and `BytecodeGenerator` tests have been updated to avoid invoking the lower transformation step before the `BytecodeGenerator` is called. > > A new internal operation, `ConstantLabelSwitchOp`, has been introduced. This acts as an intermediate representation for lowered `SwitchExpressionOp` and `SwitchStatementOp` instances with constant labels. > > Lowering of `SwitchExpressionOp` and `SwitchStatementOp` into `ConstantLabelSwitchOp` is also a part of this PR. > > Lowering of `BreakOp`, `SwitchFallthroughOp` and nested switches has been implemented in this PR. > > The PR also fixes standard lowering of `SwitchStatementOp` with default case fall-through. > > This PR also makes minor refinements to the BytecodeGenerator post-processing transformations. This pull request has now been integrated. Changeset: 832efca9 Author: Adam Sotona URL: https://git.openjdk.org/babylon/commit/832efca9d9e2769118226c532af5e2fc17eb8ba5 Stats: 1428 lines in 24 files changed: 1170 ins; 176 del; 82 mod BytecodeGenerator cleanup and switch support Co-authored-by: Mourad Abbay ------------- PR: https://git.openjdk.org/babylon/pull/706 From gfrost at openjdk.org Thu Dec 4 15:13:01 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 4 Dec 2025 15:13:01 GMT Subject: [code-reflection] Integrated: Job builder was dropping javac jvmopts Message-ID: env.bash was pointing to exploded image rather than image. We also had a job bldr bug. job bldr was collecting the javac opts but then sadly discarding them . So when pointing to exploded image this was fine., but when we pointed to the images/jdk we failed to compile code using jdk.incubator.code becuase we had dropped --modules=jdk.incudbator.code option ------------- Commit messages: - Job builder was dropping javac jvmopts Changes: https://git.openjdk.org/babylon/pull/727/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=727&range=00 Stats: 18 lines in 3 files changed: 5 ins; 8 del; 5 mod Patch: https://git.openjdk.org/babylon/pull/727.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/727/head:pull/727 PR: https://git.openjdk.org/babylon/pull/727 From gfrost at openjdk.org Thu Dec 4 15:13:03 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 4 Dec 2025 15:13:03 GMT Subject: [code-reflection] Integrated: Job builder was dropping javac jvmopts In-Reply-To: References: Message-ID: On Thu, 4 Dec 2025 14:48:46 GMT, Gary Frost wrote: > env.bash was pointing to exploded image rather than image. > > We also had a job bldr bug. > > job bldr was collecting the javac opts but then sadly discarding them . > > So when pointing to exploded image this was fine., but when we pointed to the images/jdk we failed to compile code using jdk.incubator.code becuase we had dropped --modules=jdk.incudbator.code option This pull request has now been integrated. Changeset: 2a5d7e13 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/2a5d7e1387f21c62f5b0861cbf52c3cd7a5f1040 Stats: 18 lines in 3 files changed: 5 ins; 8 del; 5 mod Job builder was dropping javac jvmopts ------------- PR: https://git.openjdk.org/babylon/pull/727 From psandoz at openjdk.org Thu Dec 4 18:48:08 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 4 Dec 2025 18:48:08 GMT Subject: [code-reflection] RFR: Make @Reflect a use-site annotation In-Reply-To: References: Message-ID: <_XMkvZTvpBA16m9VtdVDAdh-wgDKU5arIQNnG0NaxXc=.df17569f-167d-4c35-ac0a-4e97679c139a@github.com> On Thu, 4 Dec 2025 13:27:57 GMT, Maurizio Cimadamore wrote: > In the current iteration of compiler support there are two ways to make a lambda reflectable: > 1. cast the lambda to a type that is annotated with the `@Reflect` annotation (use-site) > 2. pass the lambda to a functional interface whose declaration is annotated with `@Reflect` (decl-site) > > While (2) is handy in cases where the library wants to control reflectability of the lambdas it receives, this model is too weak and insecure, as it might lead to unknowing clients exposing private impl details with frameworks using code reflection. > > For this reason, we have revamped the `@Reflect` annotation to control, at the use-site, which program elements should support code reflection: > > * If a method is annotated with `@Reflect`, the method itself is reflectable, and all the lambdas it contains are reflectable; > * If a field/local variable is annotated with `@Reflect`, all the lambdas that occur inside the initializer (if present), are reflectable; > * If a cast type is annotated with `@Reflect` and the cast is applied to a lambda expression, that lambda expression is reflectable (this is the same as (1) above). > > This means it's no longer possible for a library to create a reflectable functional interface, like: > > > @Reflect > interface ReflectableRunnable extends Runnable { } > > > And unilaterally decide, for _all_ clients whether their lambdas should be reflectable. > > To be clear, this is **not** how things will work longer term, but it's an interim step which provides the desired level of safety w/o requiring the additional language features. > > I've fixed all tests. I've tried to simplify both javac and JDK tests by dropping redundant functional interface declarations. > > I also fixed all the samples; for ONNX some tweaks were done, and I've decided to drop the OnnxFunction -- and to use a supplier instead. But if that's not desirable I can change back (or it can be changed back later). > > I also fixed HAT tests -- in that case it was a bit trickier, as there's lots of tests that end up passing reflectable lambdas to the HAT's compute method. Luckily, all these tests are annotated with `@HatTest`, so I've simply added an extra `@Reflect` to any such test method. Since `@Reflect` now propagates to the body, this guarantees that all the lambdas inside these test methods are treated as reflectable. > > Of course these HAT change end up enabling reflection for a lot more than it's required. I'll leave it to people more expert with HAT to clean that up, if needed. > In the meantime, it was ... Very good simplification for the initial mechanism to declare reflectable methods and lambdas. The HAT examples need updating to declare the compute lambda as reflectable. I recommend using a cast for al these, and we can deal with the specialized interface later on if need be. src/jdk.incubator.code/share/classes/jdk/incubator/code/Reflect.java line 43: > 41: *
  • When a method is annotated with this annotation, the method becomes reflectable, and all the lambda expressions > 42: * and method references enclosed in it also become reflectable.
  • > 43: *
  • When a variable declaration (a field, or a local variable) is annotated with this annotation, all the methods, lambda expressions What does it mean "all the methods" in the context of an initializer expression? ------------- PR Review: https://git.openjdk.org/babylon/pull/726#pullrequestreview-3541427985 PR Review Comment: https://git.openjdk.org/babylon/pull/726#discussion_r2590172871 From psandoz at openjdk.org Thu Dec 4 18:48:11 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 4 Dec 2025 18:48:11 GMT Subject: [code-reflection] RFR: Make @Reflect a use-site annotation In-Reply-To: References: Message-ID: On Thu, 4 Dec 2025 13:39:06 GMT, Maurizio Cimadamore wrote: >> In the current iteration of compiler support there are two ways to make a lambda reflectable: >> 1. cast the lambda to a type that is annotated with the `@Reflect` annotation (use-site) >> 2. pass the lambda to a functional interface whose declaration is annotated with `@Reflect` (decl-site) >> >> While (2) is handy in cases where the library wants to control reflectability of the lambdas it receives, this model is too weak and insecure, as it might lead to unknowing clients exposing private impl details with frameworks using code reflection. >> >> For this reason, we have revamped the `@Reflect` annotation to control, at the use-site, which program elements should support code reflection: >> >> * If a method is annotated with `@Reflect`, the method itself is reflectable, and all the lambdas it contains are reflectable; >> * If a field/local variable is annotated with `@Reflect`, all the lambdas that occur inside the initializer (if present), are reflectable; >> * If a cast type is annotated with `@Reflect` and the cast is applied to a lambda expression, that lambda expression is reflectable (this is the same as (1) above). >> >> This means it's no longer possible for a library to create a reflectable functional interface, like: >> >> >> @Reflect >> interface ReflectableRunnable extends Runnable { } >> >> >> And unilaterally decide, for _all_ clients whether their lambdas should be reflectable. >> >> To be clear, this is **not** how things will work longer term, but it's an interim step which provides the desired level of safety w/o requiring the additional language features. >> >> I've fixed all tests. I've tried to simplify both javac and JDK tests by dropping redundant functional interface declarations. >> >> I also fixed all the samples; for ONNX some tweaks were done, and I've decided to drop the OnnxFunction -- and to use a supplier instead. But if that's not desirable I can change back (or it can be changed back later). >> >> I also fixed HAT tests -- in that case it was a bit trickier, as there's lots of tests that end up passing reflectable lambdas to the HAT's compute method. Luckily, all these tests are annotated with `@HatTest`, so I've simply added an extra `@Reflect` to any such test method. Since `@Reflect` now propagates to the body, this guarantees that all the lambdas inside these test methods are treated as reflectable. >> >> Of course these HAT change end up enabling reflection for a lot more than it's required. I'll leave it to people more expert wi... > > src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java line 1499: > >> 1497: JavaType fiType = typeToTypeElement(tree.target); >> 1498: // build functional lambda >> 1499: Op lambdaOp = JavaOp.lambda(fiType, stack.body, true); > > Note: now _all_ lambdas we encounter when scanning a reflectable body are (by definition) quotable. This means that in several tests, the `isQuotable` attribute now shows up as `true` everywhere. And, in the JDK bytecode tests there is no longer a way to test that support for non-reflectable lambdas works correctly (so I dropped some tests there). Yes, if needed we could add something separately that built an explicit model (or transform an existing model, dropping the quoted property from lambda ops). ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/726#discussion_r2590104614 From duke at openjdk.org Thu Dec 4 18:59:45 2025 From: duke at openjdk.org (Ruby Chen) Date: Thu, 4 Dec 2025 18:59:45 GMT Subject: [code-reflection] RFR: ModuleOp generation from LambdaOp and FuncOp [v6] In-Reply-To: References: Message-ID: > Add support for generating a ModuleOp from either a LambdaOp or a FuncOp. The given LambdaOp will be converted into the root FuncOp, and the given FuncOp will be assigned as the root FuncOp. > > For `CoreOp.ModuleOp.ofLambdaOp()`, a unique name for the new root FuncOp must be passed as a parameter. Ruby Chen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains nine additional commits since the last revision: - Merge branch 'openjdk:code-reflection' into module-op-support - Add tests - Merge branch 'openjdk:code-reflection' into module-op-support - removing commented code - Suggested changes - Merge branch 'openjdk:code-reflection' into module-op-support - Merge branch 'openjdk:code-reflection' into module-op-support - Update src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/core/CoreOp.java Co-authored-by: Paul Sandoz - ModuleOp generation from LambdaOp and FuncOp ------------- Changes: - all: https://git.openjdk.org/babylon/pull/691/files - new: https://git.openjdk.org/babylon/pull/691/files/ad4bc853..4654c480 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=691&range=05 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=691&range=04-05 Stats: 1616 lines in 29 files changed: 1322 ins; 201 del; 93 mod Patch: https://git.openjdk.org/babylon/pull/691.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/691/head:pull/691 PR: https://git.openjdk.org/babylon/pull/691 From mcimadamore at openjdk.org Thu Dec 4 19:26:20 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 4 Dec 2025 19:26:20 GMT Subject: [code-reflection] RFR: Make @Reflect a use-site annotation [v2] In-Reply-To: References: Message-ID: > In the current iteration of compiler support there are two ways to make a lambda reflectable: > 1. cast the lambda to a type that is annotated with the `@Reflect` annotation (use-site) > 2. pass the lambda to a functional interface whose declaration is annotated with `@Reflect` (decl-site) > > While (2) is handy in cases where the library wants to control reflectability of the lambdas it receives, this model is too weak and insecure, as it might lead to unknowing clients exposing private impl details with frameworks using code reflection. > > For this reason, we have revamped the `@Reflect` annotation to control, at the use-site, which program elements should support code reflection: > > * If a method is annotated with `@Reflect`, the method itself is reflectable, and all the lambdas it contains are reflectable; > * If a field/local variable is annotated with `@Reflect`, all the lambdas that occur inside the initializer (if present), are reflectable; > * If a cast type is annotated with `@Reflect` and the cast is applied to a lambda expression, that lambda expression is reflectable (this is the same as (1) above). > > This means it's no longer possible for a library to create a reflectable functional interface, like: > > > @Reflect > interface ReflectableRunnable extends Runnable { } > > > And unilaterally decide, for _all_ clients whether their lambdas should be reflectable. > > To be clear, this is **not** how things will work longer term, but it's an interim step which provides the desired level of safety w/o requiring the additional language features. > > I've fixed all tests. I've tried to simplify both javac and JDK tests by dropping redundant functional interface declarations. > > I also fixed all the samples; for ONNX some tweaks were done, and I've decided to drop the OnnxFunction -- and to use a supplier instead. But if that's not desirable I can change back (or it can be changed back later). > > I also fixed HAT tests -- in that case it was a bit trickier, as there's lots of tests that end up passing reflectable lambdas to the HAT's compute method. Luckily, all these tests are annotated with `@HatTest`, so I've simply added an extra `@Reflect` to any such test method. Since `@Reflect` now propagates to the body, this guarantees that all the lambdas inside these test methods are treated as reflectable. > > Of course these HAT change end up enabling reflection for a lot more than it's required. I'll leave it to people more expert with HAT to clean that up, if needed. > In the meantime, it was ... Maurizio Cimadamore has updated the pull request incrementally with two additional commits since the last revision: - Fix javadoc - Fix HAT examples ------------- Changes: - all: https://git.openjdk.org/babylon/pull/726/files - new: https://git.openjdk.org/babylon/pull/726/files/11112ad9..5d2db31d Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=726&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=726&range=00-01 Stats: 75 lines in 21 files changed: 40 ins; 1 del; 34 mod Patch: https://git.openjdk.org/babylon/pull/726.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/726/head:pull/726 PR: https://git.openjdk.org/babylon/pull/726 From psandoz at openjdk.org Thu Dec 4 19:26:21 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 4 Dec 2025 19:26:21 GMT Subject: [code-reflection] RFR: Make @Reflect a use-site annotation [v2] In-Reply-To: References: Message-ID: On Thu, 4 Dec 2025 19:22:31 GMT, Maurizio Cimadamore wrote: >> In the current iteration of compiler support there are two ways to make a lambda reflectable: >> 1. cast the lambda to a type that is annotated with the `@Reflect` annotation (use-site) >> 2. pass the lambda to a functional interface whose declaration is annotated with `@Reflect` (decl-site) >> >> While (2) is handy in cases where the library wants to control reflectability of the lambdas it receives, this model is too weak and insecure, as it might lead to unknowing clients exposing private impl details with frameworks using code reflection. >> >> For this reason, we have revamped the `@Reflect` annotation to control, at the use-site, which program elements should support code reflection: >> >> * If a method is annotated with `@Reflect`, the method itself is reflectable, and all the lambdas it contains are reflectable; >> * If a field/local variable is annotated with `@Reflect`, all the lambdas that occur inside the initializer (if present), are reflectable; >> * If a cast type is annotated with `@Reflect` and the cast is applied to a lambda expression, that lambda expression is reflectable (this is the same as (1) above). >> >> This means it's no longer possible for a library to create a reflectable functional interface, like: >> >> >> @Reflect >> interface ReflectableRunnable extends Runnable { } >> >> >> And unilaterally decide, for _all_ clients whether their lambdas should be reflectable. >> >> To be clear, this is **not** how things will work longer term, but it's an interim step which provides the desired level of safety w/o requiring the additional language features. >> >> I've fixed all tests. I've tried to simplify both javac and JDK tests by dropping redundant functional interface declarations. >> >> I also fixed all the samples; for ONNX some tweaks were done, and I've decided to drop the OnnxFunction -- and to use a supplier instead. But if that's not desirable I can change back (or it can be changed back later). >> >> I also fixed HAT tests -- in that case it was a bit trickier, as there's lots of tests that end up passing reflectable lambdas to the HAT's compute method. Luckily, all these tests are annotated with `@HatTest`, so I've simply added an extra `@Reflect` to any such test method. Since `@Reflect` now propagates to the body, this guarantees that all the lambdas inside these test methods are treated as reflectable. >> >> Of course these HAT change end up enabling reflection for a lot more than it's required. I'll leave it to people more expert wi... > > Maurizio Cimadamore has updated the pull request incrementally with two additional commits since the last revision: > > - Fix javadoc > - Fix HAT examples Marked as reviewed by psandoz (Lead). ------------- PR Review: https://git.openjdk.org/babylon/pull/726#pullrequestreview-3541700718 From mcimadamore at openjdk.org Thu Dec 4 19:26:22 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 4 Dec 2025 19:26:22 GMT Subject: [code-reflection] RFR: Make @Reflect a use-site annotation [v2] In-Reply-To: <_XMkvZTvpBA16m9VtdVDAdh-wgDKU5arIQNnG0NaxXc=.df17569f-167d-4c35-ac0a-4e97679c139a@github.com> References: <_XMkvZTvpBA16m9VtdVDAdh-wgDKU5arIQNnG0NaxXc=.df17569f-167d-4c35-ac0a-4e97679c139a@github.com> Message-ID: <5ON4qTfZbTcuw6eCnNCnXpEcNPc8wjT5aE6nHeg2nA8=.2b29c1da-d706-4bd9-8125-741a48542fdc@github.com> On Thu, 4 Dec 2025 18:41:00 GMT, Paul Sandoz wrote: >> Maurizio Cimadamore has updated the pull request incrementally with two additional commits since the last revision: >> >> - Fix javadoc >> - Fix HAT examples > > src/jdk.incubator.code/share/classes/jdk/incubator/code/Reflect.java line 43: > >> 41: *
  • When a method is annotated with this annotation, the method becomes reflectable, and all the lambda expressions >> 42: * and method references enclosed in it also become reflectable.
  • >> 43: *
  • When a variable declaration (a field, or a local variable) is annotated with this annotation, all the methods, lambda expressions > > What does it mean "all the methods" in the context of an initializer expression? I was thinking inner classes, but we don't support those... it's a leftover... ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/726#discussion_r2590274330 From duke at openjdk.org Thu Dec 4 21:04:53 2025 From: duke at openjdk.org (Ruby Chen) Date: Thu, 4 Dec 2025 21:04:53 GMT Subject: [code-reflection] RFR: ModuleOp generation from LambdaOp and FuncOp [v7] In-Reply-To: References: Message-ID: <_DPPl-coxc11AGZaQkvC1cMkv5T-kN8GxdSGVqQtI5g=.a3e93a77-9095-47fa-90da-6b8840631120@github.com> > Add support for generating a ModuleOp from either a LambdaOp or a FuncOp. The given LambdaOp will be converted into the root FuncOp, and the given FuncOp will be assigned as the root FuncOp. > > For `CoreOp.ModuleOp.ofLambdaOp()`, a unique name for the new root FuncOp must be passed as a parameter. Ruby Chen has updated the pull request incrementally with one additional commit since the last revision: fixed tests ------------- Changes: - all: https://git.openjdk.org/babylon/pull/691/files - new: https://git.openjdk.org/babylon/pull/691/files/4654c480..1cc33001 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=691&range=06 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=691&range=05-06 Stats: 292 lines in 3 files changed: 16 ins; 247 del; 29 mod Patch: https://git.openjdk.org/babylon/pull/691.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/691/head:pull/691 PR: https://git.openjdk.org/babylon/pull/691 From mcimadamore at openjdk.org Thu Dec 4 22:31:41 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 4 Dec 2025 22:31:41 GMT Subject: git: openjdk/babylon: code-reflection: Make @Reflect a use-site annotation Message-ID: <1e75cb72-8885-4509-9e21-ef89f3c458fb@openjdk.org> Changeset: 41258469 Branch: code-reflection Author: Maurizio Cimadamore Date: 2025-12-04 22:29:54 +0000 URL: https://git.openjdk.org/babylon/commit/412584690efed4efb030ebde775c47642996d407 Make @Reflect a use-site annotation Reviewed-by: psandoz ! cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxRuntime.java ! cr-examples/onnx/src/test/java/oracle/code/onnx/CNNTest.java ! cr-examples/onnx/src/test/java/oracle/code/onnx/SimpleTest.java ! cr-examples/onnx/src/test/java/oracle/code/onnx/WalkTheMazeTest.java ! hat/examples/blackscholes/src/main/java/blackscholes/Main.java ! hat/examples/experiments/src/main/java/experiments/ForTests.java ! hat/examples/experiments/src/main/java/experiments/LocalArray.java ! hat/examples/experiments/src/main/java/experiments/LocalIds.java ! hat/examples/experiments/src/main/java/experiments/Mesh.java ! hat/examples/experiments/src/main/java/experiments/MinBufferTest.java ! hat/examples/experiments/src/main/java/experiments/PrefixSum.java ! hat/examples/experiments/src/main/java/experiments/QuotedArrayArg.java ! hat/examples/experiments/src/main/java/experiments/QuotedConstantArgs.java ! hat/examples/experiments/src/main/java/experiments/Reduction.java ! hat/examples/experiments/src/main/java/experiments/spirv/Bad.java ! hat/examples/experiments/src/main/java/experiments/spirv/GetBackend.java ! hat/examples/experiments/src/main/java/experiments/spirv/MatrixMultiply.java ! hat/examples/heal/src/main/java/heal/Compute.java ! hat/examples/life/src/main/java/life/Main.java ! hat/examples/mandel/src/main/java/mandel/Main.java ! hat/examples/matmul/src/main/java/matmul/Main.java ! hat/examples/nbody/src/main/java/nbody/opencl/OpenCLNBodyGLWindow.java ! hat/examples/squares/src/main/java/squares/Main.java ! hat/examples/violajones/src/main/java/violajones/Main.java ! hat/tests/src/main/java/hat/test/TestArrayView.java ! hat/tests/src/main/java/hat/test/TestArrays.java ! hat/tests/src/main/java/hat/test/TestBFloat16Type.java ! hat/tests/src/main/java/hat/test/TestBlackscholes.java ! hat/tests/src/main/java/hat/test/TestConstants.java ! hat/tests/src/main/java/hat/test/TestDeviceType.java ! hat/tests/src/main/java/hat/test/TestF16Type.java ! hat/tests/src/main/java/hat/test/TestFloat2.java ! hat/tests/src/main/java/hat/test/TestLocal.java ! hat/tests/src/main/java/hat/test/TestMandel.java ! hat/tests/src/main/java/hat/test/TestMatMul.java ! hat/tests/src/main/java/hat/test/TestNbody.java ! hat/tests/src/main/java/hat/test/TestParenthesis.java ! hat/tests/src/main/java/hat/test/TestPrivate.java ! hat/tests/src/main/java/hat/test/TestReductions.java ! hat/tests/src/main/java/hat/test/TestVectorArrayView.java ! hat/tests/src/main/java/hat/test/TestVectorTypes.java ! src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties ! src/jdk.incubator.code/share/classes/jdk/incubator/code/Reflect.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java ! test/jdk/java/lang/reflect/code/TestLambdaOps.java ! test/jdk/java/lang/reflect/code/TestMethodRefLambda.java ! test/jdk/java/lang/reflect/code/bytecode/TestBytecode.java ! test/jdk/java/lang/reflect/code/bytecode/lift/TestBytecodeLift.java ! test/jdk/java/lang/reflect/code/linq/Queryable.java - test/jdk/java/lang/reflect/code/linq/QuotableFunction.java - test/jdk/java/lang/reflect/code/linq/QuotablePredicate.java ! test/jdk/java/lang/reflect/code/linq/TestLinq.java ! test/jdk/java/lang/reflect/code/stream/StreamFuser.java ! test/jdk/java/lang/reflect/code/stream/TestStream.java ! test/langtools/tools/javac/diags/examples.not-yet.txt ! test/langtools/tools/javac/reflect/BlockTest.java ! test/langtools/tools/javac/reflect/BoxingConversionTest.java ! test/langtools/tools/javac/reflect/CodeReflectionTester.java ! test/langtools/tools/javac/reflect/ConditionalExpressionTest.java ! test/langtools/tools/javac/reflect/ForLoopTest.java ! test/langtools/tools/javac/reflect/ImplicitConversionTest.java ! test/langtools/tools/javac/reflect/IntersectionTypeTest.java ! test/langtools/tools/javac/reflect/LambdaTest.java ! test/langtools/tools/javac/reflect/MethodReferenceTest.java ! test/langtools/tools/javac/reflect/NullTest.java - test/langtools/tools/javac/reflect/QuotableSubtypeTest.java - test/langtools/tools/javac/reflect/QuotedSameInstanceTest.java + test/langtools/tools/javac/reflect/ReflectableLambdaSameInstanceTest.java = test/langtools/tools/javac/reflect/ReflectableLambdaTest.java ! test/langtools/tools/javac/reflect/TestNoCodeReflectionInInnerClasses.java ! test/langtools/tools/javac/reflect/TestNoCodeReflectionInInnerClasses.out ! test/langtools/tools/javac/reflect/UnreachableTest.java From mcimadamore at openjdk.org Thu Dec 4 22:32:46 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Thu, 4 Dec 2025 22:32:46 GMT Subject: [code-reflection] Integrated: Make @Reflect a use-site annotation In-Reply-To: References: Message-ID: On Thu, 4 Dec 2025 13:27:57 GMT, Maurizio Cimadamore wrote: > In the current iteration of compiler support there are two ways to make a lambda reflectable: > 1. cast the lambda to a type that is annotated with the `@Reflect` annotation (use-site) > 2. pass the lambda to a functional interface whose declaration is annotated with `@Reflect` (decl-site) > > While (2) is handy in cases where the library wants to control reflectability of the lambdas it receives, this model is too weak and insecure, as it might lead to unknowing clients exposing private impl details with frameworks using code reflection. > > For this reason, we have revamped the `@Reflect` annotation to control, at the use-site, which program elements should support code reflection: > > * If a method is annotated with `@Reflect`, the method itself is reflectable, and all the lambdas it contains are reflectable; > * If a field/local variable is annotated with `@Reflect`, all the lambdas that occur inside the initializer (if present), are reflectable; > * If a cast type is annotated with `@Reflect` and the cast is applied to a lambda expression, that lambda expression is reflectable (this is the same as (1) above). > > This means it's no longer possible for a library to create a reflectable functional interface, like: > > > @Reflect > interface ReflectableRunnable extends Runnable { } > > > And unilaterally decide, for _all_ clients whether their lambdas should be reflectable. > > To be clear, this is **not** how things will work longer term, but it's an interim step which provides the desired level of safety w/o requiring the additional language features. > > I've fixed all tests. I've tried to simplify both javac and JDK tests by dropping redundant functional interface declarations. > > I also fixed all the samples; for ONNX some tweaks were done, and I've decided to drop the OnnxFunction -- and to use a supplier instead. But if that's not desirable I can change back (or it can be changed back later). > > I also fixed HAT tests -- in that case it was a bit trickier, as there's lots of tests that end up passing reflectable lambdas to the HAT's compute method. Luckily, all these tests are annotated with `@HatTest`, so I've simply added an extra `@Reflect` to any such test method. Since `@Reflect` now propagates to the body, this guarantees that all the lambdas inside these test methods are treated as reflectable. > > Of course these HAT change end up enabling reflection for a lot more than it's required. I'll leave it to people more expert with HAT to clean that up, if needed. > In the meantime, it was ... This pull request has now been integrated. Changeset: 41258469 Author: Maurizio Cimadamore URL: https://git.openjdk.org/babylon/commit/412584690efed4efb030ebde775c47642996d407 Stats: 1055 lines in 72 files changed: 321 ins; 576 del; 158 mod Make @Reflect a use-site annotation Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/726 From psandoz at openjdk.org Thu Dec 4 23:35:31 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 4 Dec 2025 23:35:31 GMT Subject: [code-reflection] RFR: ModuleOp generation from LambdaOp and FuncOp [v7] In-Reply-To: <_DPPl-coxc11AGZaQkvC1cMkv5T-kN8GxdSGVqQtI5g=.a3e93a77-9095-47fa-90da-6b8840631120@github.com> References: <_DPPl-coxc11AGZaQkvC1cMkv5T-kN8GxdSGVqQtI5g=.a3e93a77-9095-47fa-90da-6b8840631120@github.com> Message-ID: On Thu, 4 Dec 2025 21:04:53 GMT, Ruby Chen wrote: >> Add support for generating a ModuleOp from either a LambdaOp or a FuncOp. The given LambdaOp will be converted into the root FuncOp, and the given FuncOp will be assigned as the root FuncOp. >> >> For `CoreOp.ModuleOp.ofLambdaOp()`, a unique name for the new root FuncOp must be passed as a parameter. > > Ruby Chen has updated the pull request incrementally with one additional commit since the last revision: > > fixed tests src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/core/CoreOp.java line 370: > 368: stack.add(f); > 369: while (!stack.isEmpty()) { > 370: CoreOp.FuncOp cur = stack.removeLast(); I find it easier to think in terms of pop/push. I see why you are doing this, to preserve the order of the call graph. Add a comment why you are working from the other end of the stack. You can accumulate into an array list (not a linked list) then do `stack.addAll(temp.reversed())` (also choose a better name than `temp`). Alternatively use pop and push, accumulating into a list and then pushing on the stack like so: for (FuncOp f : invokedFuncs.reversed()) { work.push(f); } src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/core/CoreOp.java line 372: > 370: CoreOp.FuncOp cur = stack.removeLast(); > 371: if (!visited.add(cur)) continue; > 372: funcs.add(convertInvokeToFuncCallOp(cur, l)); You are traversing the model and resolving methods twice, you can combine the two. If you want to keep it a separate method then pass the temporary list of the encountered invokes to reflectable methods. src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/core/CoreOp.java line 390: > 388: public static CoreOp.ModuleOp ofLambdaOp(JavaOp.LambdaOp lambdaOp, MethodHandles.Lookup l, String lambdaName) { > 389: boolean methodNameExists = Arrays.stream(l.lookupClass().getMethods()) > 390: .anyMatch(method -> method.getName().equals(lambdaName)); I don't think that check is right. To do this properly we would have to check against the names of methods encountered in the call graph. In general we have another naming clash problem with overloaded methods. A simple approach is to always postfix the function name with the topologically sorted index e.g. "_" test/jdk/java/lang/reflect/code/TestLambdaOps.java line 238: > 236: LambdaOp qop = (LambdaOp) Op.ofQuotable(lambda).get().op(); > 237: FuncOp funcOp = qop.toFuncOp(null); > 238: System.out.println(funcOp.toText()); That's not making any assertions. Use the interpreter to invoke the function and lambda with the same arguments, and assert they produce the same result. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/691#discussion_r2590919683 PR Review Comment: https://git.openjdk.org/babylon/pull/691#discussion_r2590906013 PR Review Comment: https://git.openjdk.org/babylon/pull/691#discussion_r2590930963 PR Review Comment: https://git.openjdk.org/babylon/pull/691#discussion_r2590935907 From psandoz at openjdk.org Fri Dec 5 23:18:49 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 5 Dec 2025 23:18:49 GMT Subject: [babylon-docs:master] Integrated: Update code model article. Message-ID: Update the code model API to be in sync. ------------- Commit messages: - Update code snippet - Update code model article. Changes: https://git.openjdk.org/babylon-docs/pull/10/files Webrev: https://webrevs.openjdk.org/?repo=babylon-docs&pr=10&range=00 Stats: 333 lines in 1 file changed: 33 ins; 9 del; 291 mod Patch: https://git.openjdk.org/babylon-docs/pull/10.diff Fetch: git fetch https://git.openjdk.org/babylon-docs.git pull/10/head:pull/10 PR: https://git.openjdk.org/babylon-docs/pull/10 From psandoz at openjdk.org Fri Dec 5 23:18:49 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 5 Dec 2025 23:18:49 GMT Subject: [babylon-docs:master] Integrated: Update code model article. In-Reply-To: References: Message-ID: On Fri, 5 Dec 2025 23:11:32 GMT, Paul Sandoz wrote: > Update the code model API to be in sync. This pull request has now been integrated. Changeset: 60bbceb5 Author: Paul Sandoz URL: https://git.openjdk.org/babylon-docs/commit/60bbceb5e2636130e35022952b84d7b4efba2b17 Stats: 333 lines in 1 file changed: 33 ins; 9 del; 291 mod Update code model article. ------------- PR: https://git.openjdk.org/babylon-docs/pull/10 From psandoz at openjdk.org Fri Dec 5 23:29:58 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 5 Dec 2025 23:29:58 GMT Subject: git: openjdk/babylon: code-reflection: Simplify CodeElement.elements Message-ID: <8445b669-6cf6-460c-bc44-a4620fd9acb4@openjdk.org> Changeset: dd77b6b7 Branch: code-reflection Author: Paul Sandoz Date: 2025-12-05 23:26:23 +0000 URL: https://git.openjdk.org/babylon/commit/dd77b6b7e4102d9e908e5cc04420ce597d6c56ec Simplify CodeElement.elements ! src/jdk.incubator.code/share/classes/jdk/incubator/code/CodeElement.java ! test/jdk/java/lang/reflect/code/TestExpressionGraphs.java From psandoz at openjdk.org Fri Dec 5 23:30:02 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 5 Dec 2025 23:30:02 GMT Subject: [code-reflection] Integrated: Simplify CodeElement.elements Message-ID: Simplify CodeElement.elements. Update TestExpressionGraphs to use streams only and be in sync with https://openjdk.org/projects/babylon/articles/code-models ------------- Commit messages: - Add back comment. - Simplify CodeElement.elements Changes: https://git.openjdk.org/babylon/pull/728/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=728&range=00 Stats: 37 lines in 2 files changed: 4 ins; 26 del; 7 mod Patch: https://git.openjdk.org/babylon/pull/728.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/728/head:pull/728 PR: https://git.openjdk.org/babylon/pull/728 From psandoz at openjdk.org Fri Dec 5 23:30:02 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 5 Dec 2025 23:30:02 GMT Subject: [code-reflection] Integrated: Simplify CodeElement.elements In-Reply-To: References: Message-ID: On Fri, 5 Dec 2025 23:22:07 GMT, Paul Sandoz wrote: > Simplify CodeElement.elements. > > Update TestExpressionGraphs to use streams only and be in sync with https://openjdk.org/projects/babylon/articles/code-models This pull request has now been integrated. Changeset: dd77b6b7 Author: Paul Sandoz URL: https://git.openjdk.org/babylon/commit/dd77b6b7e4102d9e908e5cc04420ce597d6c56ec Stats: 37 lines in 2 files changed: 4 ins; 26 del; 7 mod Simplify CodeElement.elements ------------- PR: https://git.openjdk.org/babylon/pull/728 From duke at openjdk.org Fri Dec 5 23:30:37 2025 From: duke at openjdk.org (duke) Date: Fri, 5 Dec 2025 23:30:37 GMT Subject: git: openjdk/babylon-docs: master: 2 new changesets Message-ID: <4b82cf57-b190-4739-a55e-f090ea146285@openjdk.org> Changeset: f0ec1dbc Branch: master Author: Paul Sandoz Committer: GitHub Date: 2025-12-05 15:29:21 +0000 URL: https://git.openjdk.org/babylon-docs/commit/f0ec1dbc1f1ec0f53948a6540003bb1fb5543380 Update date ! site/_index.md Changeset: 7a8ca77c Branch: master Author: Paul Sandoz Committer: GitHub Date: 2025-12-05 15:29:52 +0000 URL: https://git.openjdk.org/babylon-docs/commit/7a8ca77c19c4acb6dc116f80d42c1fb4e8cf8521 Fix typo ! site/_index.md From gfrost at openjdk.org Sat Dec 6 13:17:09 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 6 Dec 2025 13:17:09 GMT Subject: git: openjdk/babylon: code-reflection: Cleaned up NDRange and initialization of KernelBufferContext Message-ID: <4c8dfd95-5b72-4ad7-9c0d-4906d70d7597@openjdk.org> Changeset: cbb45292 Branch: code-reflection Author: Gary Frost Date: 2025-12-06 13:14:33 +0000 URL: https://git.openjdk.org/babylon/commit/cbb45292a35921cac5c83b1af8407b4f10d7d53b Cleaned up NDRange and initialization of KernelBufferContext ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/core/src/main/java/hat/ComputeContext.java ! hat/core/src/main/java/hat/KernelContext.java ! hat/core/src/main/java/hat/NDRange.java ! hat/core/src/main/java/hat/backend/java/WorkStealer.java From gfrost at openjdk.org Sat Dec 6 13:18:15 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 6 Dec 2025 13:18:15 GMT Subject: [code-reflection] Integrated: Cleaned up NDRange and initialization of KernelBufferContext Message-ID: In preparing for specializomng kernel code based on Local dispatch dims I wanted to cleanup NDRange Also simplify the initialization of KernelBufferContext (removed mesh initialisation code) ------------- Commit messages: - Cleaned up NDRange and initialization of KernelBufferContext Changes: https://git.openjdk.org/babylon/pull/729/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=729&range=00 Stats: 216 lines in 5 files changed: 40 ins; 93 del; 83 mod Patch: https://git.openjdk.org/babylon/pull/729.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/729/head:pull/729 PR: https://git.openjdk.org/babylon/pull/729 From gfrost at openjdk.org Sat Dec 6 13:18:15 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 6 Dec 2025 13:18:15 GMT Subject: [code-reflection] Integrated: Cleaned up NDRange and initialization of KernelBufferContext In-Reply-To: References: Message-ID: On Sat, 6 Dec 2025 13:11:13 GMT, Gary Frost wrote: > In preparing for specializomng kernel code based on Local dispatch dims I wanted to cleanup NDRange > > Also simplify the initialization of KernelBufferContext (removed mesh initialisation code) This pull request has now been integrated. Changeset: cbb45292 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/cbb45292a35921cac5c83b1af8407b4f10d7d53b Stats: 216 lines in 5 files changed: 40 ins; 93 del; 83 mod Cleaned up NDRange and initialization of KernelBufferContext ------------- PR: https://git.openjdk.org/babylon/pull/729 From gfrost at openjdk.org Sat Dec 6 15:17:58 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 6 Dec 2025 15:17:58 GMT Subject: git: openjdk/babylon: code-reflection: More C99 code gen cleanup Message-ID: <753bcac1-7d4d-4fce-b268-28a41f221542@openjdk.org> Changeset: a1f80ed3 Branch: code-reflection Author: Gary Frost Date: 2025-12-06 15:16:11 +0000 URL: https://git.openjdk.org/babylon/commit/a1f80ed3da2cbf335d5e804daaff259023163556 More C99 code gen cleanup ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLHATKernelBuilder.java ! hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLHatKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/optools/OpTk.java From gfrost at openjdk.org Sat Dec 6 15:19:05 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 6 Dec 2025 15:19:05 GMT Subject: [code-reflection] Integrated: More C99 code gen cleanup Message-ID: Just tidying up some C99 code gen. I added OpTk helpers and resused existing helper. ------------- Commit messages: - More C99 code gecn cleanup Changes: https://git.openjdk.org/babylon/pull/730/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=730&range=00 Stats: 147 lines in 4 files changed: 10 ins; 52 del; 85 mod Patch: https://git.openjdk.org/babylon/pull/730.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/730/head:pull/730 PR: https://git.openjdk.org/babylon/pull/730 From gfrost at openjdk.org Sat Dec 6 15:19:05 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 6 Dec 2025 15:19:05 GMT Subject: [code-reflection] Integrated: More C99 code gen cleanup In-Reply-To: References: Message-ID: On Sat, 6 Dec 2025 15:12:19 GMT, Gary Frost wrote: > Just tidying up some C99 code gen. > > I added OpTk helpers and resused existing helper. This pull request has now been integrated. Changeset: a1f80ed3 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/a1f80ed3da2cbf335d5e804daaff259023163556 Stats: 147 lines in 4 files changed: 10 ins; 52 del; 85 mod More C99 code gen cleanup ------------- PR: https://git.openjdk.org/babylon/pull/730 From gfrost at openjdk.org Sun Dec 7 15:40:42 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 7 Dec 2025 15:40:42 GMT Subject: git: openjdk/babylon: code-reflection: Fixed the class heiarchy of codegen builders Message-ID: <9c271b8c-ac2f-4249-929c-b0e6feb5dd67@openjdk.org> Changeset: db8002c4 Branch: code-reflection Author: Gary Frost Date: 2025-12-07 15:37:18 +0000 URL: https://git.openjdk.org/babylon/commit/db8002c414f7486da7f15863166b102767a7119a Fixed the class heiarchy of codegen builders ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/PTXHATKernelBuilder.java ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLHATKernelBuilder.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLBackend.java = hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLHATKernelBuilder.java ! hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLHatKernelBuilder.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/C99JExtractedBackend.java ! hat/core/src/main/java/hat/FFIConfigCreator.java ! hat/core/src/main/java/hat/buffer/SchemaBuilder.java + hat/core/src/main/java/hat/codebuilders/BabylonCoreOpBuilder.java + hat/core/src/main/java/hat/codebuilders/BabylonKernelOpBuilder.java - hat/core/src/main/java/hat/codebuilders/BabylonOpBuilder.java - hat/core/src/main/java/hat/codebuilders/C99CodeBuilder.java + hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilder.java + hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATComputeBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATConfigBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/CodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilder.java - hat/core/src/main/java/hat/codebuilders/HATCodeBuilderWithContext.java ! hat/core/src/main/java/hat/codebuilders/TextBuilder.java ! hat/core/src/main/java/hat/device/DeviceSchema.java ! hat/tools/src/main/java/hat/tools/text/JavaHATCodeBuilder.java From gfrost at openjdk.org Sun Dec 7 15:41:20 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 7 Dec 2025 15:41:20 GMT Subject: [code-reflection] Integrated: Fixed the class heiarchy of codegen builders Message-ID: Fixed the class hierachy for C99 code builders. Moved non C99 genaration out from common CodeBuilders. ------------- Commit messages: - Fixed the class heiarchy of codegen builders Changes: https://git.openjdk.org/babylon/pull/731/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=731&range=00 Stats: 3105 lines in 25 files changed: 1476 ins; 1484 del; 145 mod Patch: https://git.openjdk.org/babylon/pull/731.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/731/head:pull/731 PR: https://git.openjdk.org/babylon/pull/731 From gfrost at openjdk.org Sun Dec 7 15:41:22 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 7 Dec 2025 15:41:22 GMT Subject: [code-reflection] Integrated: Fixed the class heiarchy of codegen builders In-Reply-To: References: Message-ID: On Sun, 7 Dec 2025 15:34:41 GMT, Gary Frost wrote: > Fixed the class hierachy for C99 code builders. > > Moved non C99 genaration out from common CodeBuilders. This pull request has now been integrated. Changeset: db8002c4 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/db8002c414f7486da7f15863166b102767a7119a Stats: 3105 lines in 25 files changed: 1476 ins; 1484 del; 145 mod Fixed the class heiarchy of codegen builders ------------- PR: https://git.openjdk.org/babylon/pull/731 From duke at openjdk.org Mon Dec 8 02:17:20 2025 From: duke at openjdk.org (Ruby Chen) Date: Mon, 8 Dec 2025 02:17:20 GMT Subject: [code-reflection] RFR: Add DeviceType support for array views Message-ID: Adding support for both MappableIface and DeviceType to array views. Also shifting the array view phase earlier in the compilation stages. Minor refactoring for array view phase. ------------- Commit messages: - Add DeviceType support for array views Changes: https://git.openjdk.org/babylon/pull/732/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=732&range=00 Stats: 201 lines in 2 files changed: 112 ins; 5 del; 84 mod Patch: https://git.openjdk.org/babylon/pull/732.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/732/head:pull/732 PR: https://git.openjdk.org/babylon/pull/732 From gfrost at openjdk.org Mon Dec 8 11:04:54 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 11:04:54 GMT Subject: git: openjdk/babylon: code-reflection: Hat fix java codebuilder Message-ID: <7a63ef30-bb7f-4198-a1eb-44208b104a1e@openjdk.org> Changeset: ae26fcd5 Branch: code-reflection Author: Gary Frost Date: 2025-12-08 11:03:19 +0000 URL: https://git.openjdk.org/babylon/commit/ae26fcd538ad75921b07a2eb8887268a07f791bc Hat fix java codebuilder - hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLHatKernelBuilder.java + hat/hat/tool ! hat/tools/src/main/java/hat/tools/text/JavaHATCodeBuilder.java From gfrost at openjdk.org Mon Dec 8 11:05:45 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 11:05:45 GMT Subject: [code-reflection] Integrated: Hat fix java codebuilder Message-ID: Previous PR regressed java code builder. ------------- Commit messages: - OpenCLHatKernelBuilder.java to OpenCLHATKernelBuilder.java - Fix NPE in java code builder Changes: https://git.openjdk.org/babylon/pull/733/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=733&range=00 Stats: 218 lines in 3 files changed: 1 ins; 215 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/733.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/733/head:pull/733 PR: https://git.openjdk.org/babylon/pull/733 From gfrost at openjdk.org Mon Dec 8 11:05:47 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 11:05:47 GMT Subject: [code-reflection] Integrated: Hat fix java codebuilder In-Reply-To: References: Message-ID: <27Y4wZXWl2vXvc5BDSMvs1Ja0R6VMKLykkPCYQSRWPs=.aa9fd262-e332-4bd0-ab29-270fed47b934@github.com> On Mon, 8 Dec 2025 11:00:16 GMT, Gary Frost wrote: > Previous PR regressed java code builder. This pull request has now been integrated. Changeset: ae26fcd5 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/ae26fcd538ad75921b07a2eb8887268a07f791bc Stats: 218 lines in 3 files changed: 1 ins; 215 del; 2 mod Hat fix java codebuilder ------------- PR: https://git.openjdk.org/babylon/pull/733 From gfrost at openjdk.org Mon Dec 8 13:30:23 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 13:30:23 GMT Subject: [code-reflection] RFR: last pr caused grief. Mac os filename change case Message-ID: Last PR was broken sadly Macos and git can't quite handle changing the case of a filename ------------- Commit messages: - last pr caused grief. Mac os filename change case Changes: https://git.openjdk.org/babylon/pull/734/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=734&range=00 Stats: 641 lines in 6 files changed: 212 ins; 426 del; 3 mod Patch: https://git.openjdk.org/babylon/pull/734.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/734/head:pull/734 PR: https://git.openjdk.org/babylon/pull/734 From gfrost at openjdk.org Mon Dec 8 13:38:02 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 13:38:02 GMT Subject: git: openjdk/babylon: code-reflection: last pr caused grief. Mac os filename change case Message-ID: Changeset: a696ca20 Branch: code-reflection Author: Gary Frost Date: 2025-12-08 13:36:07 +0000 URL: https://git.openjdk.org/babylon/commit/a696ca203f29ea3ed52db58f8948777c1a4e3cf4 last pr caused grief. Mac os filename change case ! hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLBackend.java - hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLHATKernelBuilder.java + hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLJExtractedHATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java From gfrost at openjdk.org Mon Dec 8 13:39:18 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 13:39:18 GMT Subject: [code-reflection] RFR: last pr caused grief. Mac os filename change case [v2] In-Reply-To: References: Message-ID: > Last PR was broken sadly Macos and git can't quite handle changing the case of a filename Gary Frost has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits: - Merge code-reflection - last pr caused grief. Mac os filename change case ------------- Changes: https://git.openjdk.org/babylon/pull/734/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=734&range=01 Stats: 427 lines in 4 files changed: 211 ins; 213 del; 3 mod Patch: https://git.openjdk.org/babylon/pull/734.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/734/head:pull/734 PR: https://git.openjdk.org/babylon/pull/734 From gfrost at openjdk.org Mon Dec 8 13:39:19 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 13:39:19 GMT Subject: [code-reflection] Integrated: last pr caused grief. Mac os filename change case In-Reply-To: References: Message-ID: On Mon, 8 Dec 2025 13:24:11 GMT, Gary Frost wrote: > Last PR was broken sadly Macos and git can't quite handle changing the case of a filename This pull request has now been integrated. Changeset: a696ca20 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/a696ca203f29ea3ed52db58f8948777c1a4e3cf4 Stats: 427 lines in 4 files changed: 211 ins; 213 del; 3 mod last pr caused grief. Mac os filename change case ------------- PR: https://git.openjdk.org/babylon/pull/734 From gfrost at openjdk.org Mon Dec 8 14:35:56 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 14:35:56 GMT Subject: git: openjdk/babylon: code-reflection: switch text tools to use Regex Message-ID: <11479b81-0d22-49c5-90c9-c38ddd9101f7@openjdk.org> Changeset: 93b2cf3e Branch: code-reflection Author: Gary Frost Date: 2025-12-08 14:32:29 +0000 URL: https://git.openjdk.org/babylon/commit/93b2cf3eb21236c6c94b56e22012cb55e48636e1 switch text tools to use Regex ! hat/core/src/main/java/hat/util/Regex.java ! hat/examples/view/src/main/java/view/EliteMeshParser.java ! hat/tools/src/main/java/hat/tools/jdot/ui/JDot.java ! hat/tools/src/main/java/hat/tools/textmodel/BabylonTextModel.java ! hat/tools/src/main/java/hat/tools/textmodel/JavaTextModel.java ! hat/tools/src/main/java/hat/tools/textmodel/tokens/DottedName.java ! hat/tools/src/main/java/hat/tools/textmodel/tokens/IntConst.java ! hat/tools/src/main/java/hat/tools/textmodel/tokens/Leaf.java From gfrost at openjdk.org Mon Dec 8 14:36:22 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 14:36:22 GMT Subject: [code-reflection] Integrated: switch text tools to use Regex Message-ID: We have simpler Regex tool in HAT (more amenable to pattren switching) so switching uses to it ------------- Commit messages: - switch text tools to use Regex Changes: https://git.openjdk.org/babylon/pull/735/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=735&range=00 Stats: 109 lines in 8 files changed: 13 ins; 22 del; 74 mod Patch: https://git.openjdk.org/babylon/pull/735.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/735/head:pull/735 PR: https://git.openjdk.org/babylon/pull/735 From gfrost at openjdk.org Mon Dec 8 14:36:23 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 14:36:23 GMT Subject: [code-reflection] Integrated: switch text tools to use Regex In-Reply-To: References: Message-ID: On Mon, 8 Dec 2025 14:27:55 GMT, Gary Frost wrote: > We have simpler Regex tool in HAT (more amenable to pattren switching) so switching uses to it This pull request has now been integrated. Changeset: 93b2cf3e Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/93b2cf3eb21236c6c94b56e22012cb55e48636e1 Stats: 109 lines in 8 files changed: 13 ins; 22 del; 74 mod switch text tools to use Regex ------------- PR: https://git.openjdk.org/babylon/pull/735 From gfrost at openjdk.org Mon Dec 8 17:41:46 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 17:41:46 GMT Subject: git: openjdk/babylon: code-reflection: moved c99 codegen out of base class Message-ID: <5dd1ccb8-6a59-43a2-89e2-bf0a6e3c5084@openjdk.org> Changeset: 979ae333 Branch: code-reflection Author: Gary Frost Date: 2025-12-08 17:39:49 +0000 URL: https://git.openjdk.org/babylon/commit/979ae3336c068c4196840c2bbf161a63500f370e moved c99 codegen out of base class ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLHATKernelBuilder.java ! hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLJExtractedHATKernelBuilder.java ! hat/core/src/main/java/hat/FFIConfigCreator.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATConfigBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/CodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilder.java ! hat/core/src/main/java/hat/util/Regex.java From gfrost at openjdk.org Mon Dec 8 17:42:59 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 17:42:59 GMT Subject: [code-reflection] Integrated: moved c99 codegen out of base class In-Reply-To: References: Message-ID: <3cYExjH1jdityDkC_eEB5HDd0nefEHTVEanKAtUo-KE=.d462a6a5-ddcd-42a9-8a72-110a45466b7b@github.com> On Mon, 8 Dec 2025 17:36:07 GMT, Gary Frost wrote: > Found some C99 codegen classes in the base CodeGen class > > Generally tidying up all these classes in preparation for generated C99 code from Compute layer This pull request has now been integrated. Changeset: 979ae333 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/979ae3336c068c4196840c2bbf161a63500f370e Stats: 417 lines in 10 files changed: 113 ins; 194 del; 110 mod moved c99 codegen out of base class ------------- PR: https://git.openjdk.org/babylon/pull/736 From gfrost at openjdk.org Mon Dec 8 17:42:58 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 8 Dec 2025 17:42:58 GMT Subject: [code-reflection] Integrated: moved c99 codegen out of base class Message-ID: Found some C99 codegen classes in the base CodeGen class Generally tidying up all these classes in preparation for generated C99 code from Compute layer ------------- Commit messages: - moved c99 codegen out of base class Changes: https://git.openjdk.org/babylon/pull/736/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=736&range=00 Stats: 417 lines in 10 files changed: 113 ins; 194 del; 110 mod Patch: https://git.openjdk.org/babylon/pull/736.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/736/head:pull/736 PR: https://git.openjdk.org/babylon/pull/736 From psandoz at openjdk.org Mon Dec 8 18:05:54 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Mon, 8 Dec 2025 18:05:54 GMT Subject: [code-reflection] RFR: Remove CodeElement.transform Message-ID: Remove the `CodeElement.transform` method and the helper methods. Traversal of elements is performed using the `CodeElement.elements` method that returns a stream of code elements. ------------- Commit messages: - Remove comments. - Merge remote-tracking branch 'upstream/code-reflection' into rm-ce-transform - Remove CodeElement.transform method. Changes: https://git.openjdk.org/babylon/pull/737/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=737&range=00 Stats: 235 lines in 20 files changed: 47 ins; 91 del; 97 mod Patch: https://git.openjdk.org/babylon/pull/737.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/737/head:pull/737 PR: https://git.openjdk.org/babylon/pull/737 From psandoz at openjdk.org Mon Dec 8 18:10:17 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Mon, 8 Dec 2025 18:10:17 GMT Subject: [babylon-docs:master] Integrated: Updates to docs Message-ID: <7tfP-O1ex09D3Ps5qvzbvSpp_cgIbcswAFMYaLM2v_0=.62ff9106-4103-4d01-b780-c524f5ee269d@github.com> Update auto diff and linq documents. ------------- Commit messages: - Updates to docs. Changes: https://git.openjdk.org/babylon-docs/pull/11/files Webrev: https://webrevs.openjdk.org/?repo=babylon-docs&pr=11&range=00 Stats: 425 lines in 2 files changed: 41 ins; 49 del; 335 mod Patch: https://git.openjdk.org/babylon-docs/pull/11.diff Fetch: git fetch https://git.openjdk.org/babylon-docs.git pull/11/head:pull/11 PR: https://git.openjdk.org/babylon-docs/pull/11 From psandoz at openjdk.org Mon Dec 8 18:10:20 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Mon, 8 Dec 2025 18:10:20 GMT Subject: [babylon-docs:master] Integrated: Updates to docs In-Reply-To: <7tfP-O1ex09D3Ps5qvzbvSpp_cgIbcswAFMYaLM2v_0=.62ff9106-4103-4d01-b780-c524f5ee269d@github.com> References: <7tfP-O1ex09D3Ps5qvzbvSpp_cgIbcswAFMYaLM2v_0=.62ff9106-4103-4d01-b780-c524f5ee269d@github.com> Message-ID: <4RQookNv4UwtgC47cLJf2PS8aEvgwaK6DjBsusE8jpg=.5c249396-67bd-4262-bdf5-4a3b3a9efc9b@github.com> On Mon, 8 Dec 2025 18:03:24 GMT, Paul Sandoz wrote: > Update auto diff and linq documents. This pull request has now been integrated. Changeset: 9211cef3 Author: Paul Sandoz URL: https://git.openjdk.org/babylon-docs/commit/9211cef38654aee0ce2de85291c35d1386a6cbb6 Stats: 425 lines in 2 files changed: 41 ins; 49 del; 335 mod Updates to docs ------------- PR: https://git.openjdk.org/babylon-docs/pull/11 From mabbay at openjdk.org Mon Dec 8 19:39:09 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Mon, 8 Dec 2025 19:39:09 GMT Subject: [code-reflection] RFR: Fails if code model was compiled by a feature version different from the current Message-ID: <9nk78j8Q4RDPFSyfQ4K9CYcG_o9Z96n3xZv-7K0iF-I=.895417bd-ff5e-4d7e-9128-57480cb65319@github.com> Before we build a code model, we check if the Java feature version used to compile the code model matches the current one. In case there's no match, we throw an exception. ------------- Commit messages: - Fails if code model was compiled by a feature version different from the current Changes: https://git.openjdk.org/babylon/pull/738/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=738&range=00 Stats: 40 lines in 2 files changed: 40 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/738.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/738/head:pull/738 PR: https://git.openjdk.org/babylon/pull/738 From psandoz at openjdk.org Mon Dec 8 20:48:31 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Mon, 8 Dec 2025 20:48:31 GMT Subject: [code-reflection] RFR: Fails if code model was compiled by a feature version different from the current In-Reply-To: <9nk78j8Q4RDPFSyfQ4K9CYcG_o9Z96n3xZv-7K0iF-I=.895417bd-ff5e-4d7e-9128-57480cb65319@github.com> References: <9nk78j8Q4RDPFSyfQ4K9CYcG_o9Z96n3xZv-7K0iF-I=.895417bd-ff5e-4d7e-9128-57480cb65319@github.com> Message-ID: <4K4gtioHROslxxqpvycV2JL77rU3aWh9-g-js2Q9Mfs=.c659a6bf-c275-464f-b39e-6c433ea51185@github.com> On Mon, 8 Dec 2025 19:32:49 GMT, Mourad Abbay wrote: > Before we build a code model, we check if the Java feature version used to compile the code model matches the current one. In case there's no match, we throw an exception. src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java line 5268: > 5266: } > 5267: > 5268: /** Retain the declaration order pattern as for the other methods, the var args method occurs before the list method. src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/OpBuilder.java line 440: > 438: InvokeOp.InvokeKind.STATIC, true, > 439: J_L_STRING, STRING_FORMAT, > 440: t.op(constant(J_L_STRING, "Code model was compiled with java version %d, but the actual version is %d")), You can embed the expected runtime version directly in the string, there is no need to pass it a runtime. Then you can simplify further by using the string concat operation to directly concatenate the string and actual version. Suggest a string of: "The Java version used at compile time to generate and store the code model, Java " + expectedVersion + ", is not the same as the Java version used at runtime to load the code model, Java " src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/OpBuilder.java line 444: > 442: )); > 443: t.op(throw_( > 444: t.op(new_(MethodRef.constructor(IllegalStateException.class, String.class), errMessage)) Throw `UnsupportedOperationException`, and then document the throwing of that by `Op.ofMethod` and `Op.ofQuotable`. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/738#discussion_r2600001606 PR Review Comment: https://git.openjdk.org/babylon/pull/738#discussion_r2600068243 PR Review Comment: https://git.openjdk.org/babylon/pull/738#discussion_r2600061141 From psandoz at openjdk.org Mon Dec 8 23:51:41 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Mon, 8 Dec 2025 23:51:41 GMT Subject: [code-reflection] RFR: Rename compute/kernel interfaces. Message-ID: <7xwmEMMYlN6qpzths4ZaMP1xIsVnp0qrEZ0K7AlDcd0=.e4334194-1fd9-4b28-bbe9-67dcd7956db6@github.com> Rename `QuotableComputeContextConsumer` to `ComputeConsumer` and `QuotableKernelContextConsumer` to `KernelConsumer`. Since we don't have `Quotable` anymore that prefix is redundant. I also tried to reduce the name further because they, or mainly the `ComputeConsumer`, may need to be referred to in an annotated cast expression. Using the names `Compute` and `Kernel` would be more terse but at least the former conflicted with other code. ------------- Commit messages: - Merge remote-tracking branch 'upstream/code-reflection' into hat-compute-iface - Rename compute/kernel interfaces. Changes: https://git.openjdk.org/babylon/pull/739/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=739&range=00 Stats: 113 lines in 25 files changed: 3 ins; 7 del; 103 mod Patch: https://git.openjdk.org/babylon/pull/739.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/739/head:pull/739 PR: https://git.openjdk.org/babylon/pull/739 From duke at openjdk.org Tue Dec 9 01:08:10 2025 From: duke at openjdk.org (Ruby Chen) Date: Tue, 9 Dec 2025 01:08:10 GMT Subject: [code-reflection] RFR: ModuleOp generation from LambdaOp and FuncOp [v8] In-Reply-To: References: Message-ID: <3WwdNYNnbdiOSjw1UqHcQy18dkn1orWyvdu_aX8Rb1Q=.94be8993-2667-4f2e-8da7-32c0c907ef22@github.com> > Add support for generating a ModuleOp from either a LambdaOp or a FuncOp. The given LambdaOp will be converted into the root FuncOp, and the given FuncOp will be assigned as the root FuncOp. > > For `CoreOp.ModuleOp.ofLambdaOp()`, a unique name for the new root FuncOp must be passed as a parameter. Ruby Chen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision: - fixes - Merge branch 'openjdk:code-reflection' into module-op-support - fixed tests - Merge branch 'openjdk:code-reflection' into module-op-support - Add tests - Merge branch 'openjdk:code-reflection' into module-op-support - removing commented code - Suggested changes - Merge branch 'openjdk:code-reflection' into module-op-support - Merge branch 'openjdk:code-reflection' into module-op-support - ... and 2 more: https://git.openjdk.org/babylon/compare/be6432ca...e70019bf ------------- Changes: - all: https://git.openjdk.org/babylon/pull/691/files - new: https://git.openjdk.org/babylon/pull/691/files/1cc33001..e70019bf Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=691&range=07 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=691&range=06-07 Stats: 5297 lines in 115 files changed: 2121 ins; 2586 del; 590 mod Patch: https://git.openjdk.org/babylon/pull/691.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/691/head:pull/691 PR: https://git.openjdk.org/babylon/pull/691 From jfumero at openjdk.org Tue Dec 9 12:46:01 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Tue, 9 Dec 2025 12:46:01 GMT Subject: [code-reflection] RFR: Fix balanced parenthesis and structs for the CUDA backend Message-ID: Fix balanced parenthesis and structs for the CUDA backend How to test? java -cp hat/job.jar hat.java test-suite ffi-opencl java -cp hat/job.jar hat.java test-suite ffi-cuda ------------- Commit messages: - [hat] CUDA backend vector types fixed - [hat] Fix semicolon in C99 structs declaration Changes: https://git.openjdk.org/babylon/pull/741/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=741&range=00 Stats: 6 lines in 3 files changed: 3 ins; 0 del; 3 mod Patch: https://git.openjdk.org/babylon/pull/741.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/741/head:pull/741 PR: https://git.openjdk.org/babylon/pull/741 From jfumero at openjdk.org Tue Dec 9 13:11:10 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Tue, 9 Dec 2025 13:11:10 GMT Subject: git: openjdk/babylon: code-reflection: Fix balanced parenthesis and structs for the CUDA backend Message-ID: Changeset: 634b8bf4 Branch: code-reflection Author: Juan Fumero Date: 2025-12-09 13:08:45 +0000 URL: https://git.openjdk.org/babylon/commit/634b8bf4b1bf6fceab40ea0a96f082c52902ca8d Fix balanced parenthesis and structs for the CUDA backend ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/CodeBuilder.java From jfumero at openjdk.org Tue Dec 9 13:11:29 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Tue, 9 Dec 2025 13:11:29 GMT Subject: [code-reflection] Integrated: Fix balanced parenthesis and structs for the CUDA backend In-Reply-To: References: Message-ID: On Tue, 9 Dec 2025 12:41:33 GMT, Juan Fumero wrote: > Fix balanced parenthesis and structs for the CUDA backend > > How to test? > > > java -cp hat/job.jar hat.java test-suite ffi-opencl > > java -cp hat/job.jar hat.java test-suite ffi-cuda This pull request has now been integrated. Changeset: 634b8bf4 Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/634b8bf4b1bf6fceab40ea0a96f082c52902ca8d Stats: 6 lines in 3 files changed: 3 ins; 0 del; 3 mod Fix balanced parenthesis and structs for the CUDA backend ------------- PR: https://git.openjdk.org/babylon/pull/741 From gfrost at openjdk.org Tue Dec 9 13:19:30 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 9 Dec 2025 13:19:30 GMT Subject: [code-reflection] RFR: Fix balanced parenthesis and structs for the CUDA backend In-Reply-To: References: Message-ID: On Tue, 9 Dec 2025 12:41:33 GMT, Juan Fumero wrote: > Fix balanced parenthesis and structs for the CUDA backend > > How to test? > > > java -cp hat/job.jar hat.java test-suite ffi-opencl > > java -cp hat/job.jar hat.java test-suite ffi-cuda hat/core/src/main/java/hat/codebuilders/CodeBuilder.java line 500: > 498: } > 499: public T semicolonNlSeparated(Iterable iterable, Consumer consumer) { > 500: return separated(iterable,_->semicolonNl(),consumer).semicolon(); No fix this at the call site. Or it effects every use of semicolonNlSeparated... ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/741#discussion_r2602619170 From jfumero at openjdk.org Tue Dec 9 13:26:53 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Tue, 9 Dec 2025 13:26:53 GMT Subject: [code-reflection] RFR: [hat] Type transform between bfloat16 <-> float improved Message-ID: <74Z9vz2EREiL1txgAzl4-UmYaWizCnaj1pXjbQDu7ec=.dceea7e9-16d3-4ff8-bc64-0ed41b7c88f5@github.com> [hat] Type transform between bfloat16 <-> float improved. Unittests with the OpenCL backend passing. CUDA backend not passing due to another error (not related to this PR). We will merge this when we patch the CUDA backed. ------------- Commit messages: - Merge branch 'code-reflection' into hat/dev/bfloat16conv - Address comments from PR#740 - [hat] minor change - [hat] Improvements in the bfloat16 conversion from the OpenCL size Changes: https://git.openjdk.org/babylon/pull/740/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=740&range=00 Stats: 181 lines in 4 files changed: 74 ins; 45 del; 62 mod Patch: https://git.openjdk.org/babylon/pull/740.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/740/head:pull/740 PR: https://git.openjdk.org/babylon/pull/740 From gfrost at openjdk.org Tue Dec 9 13:26:58 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 9 Dec 2025 13:26:58 GMT Subject: [code-reflection] RFR: [hat] Type transform between bfloat16 <-> float improved In-Reply-To: <74Z9vz2EREiL1txgAzl4-UmYaWizCnaj1pXjbQDu7ec=.dceea7e9-16d3-4ff8-bc64-0ed41b7c88f5@github.com> References: <74Z9vz2EREiL1txgAzl4-UmYaWizCnaj1pXjbQDu7ec=.dceea7e9-16d3-4ff8-bc64-0ed41b7c88f5@github.com> Message-ID: On Tue, 9 Dec 2025 10:33:53 GMT, Juan Fumero wrote: > [hat] Type transform between bfloat16 <-> float improved. > > Unittests with the OpenCL backend passing. > CUDA backend not passing due to another error (not related to this PR). We will merge this when we patch the CUDA backed. hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilder.java line 203: > 201: } > 202: > 203: public final T declareTypeBFloat16Type(String identifier) { maybe bf16Type() hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java line 571: > 569: String identifier = "b"; > 570: return funcDef(_ -> f32Type(), > 571: _ -> builtin_bfloat16ToFloat(), bf16Type... hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java line 574: > 572: _ -> ushortType(parameterName), > 573: _ -> declareTypeBFloat16Type(identifier).semicolonNl() > 574: .identifier(identifier).dot().identifier("s").osbrace().intConstZero().csbrace().equals().constant("0x0000").semicolonNl() why constant("0x00000") why not intConstZer(0) or intvalue(0) Replace osbrace() . xxx() .csbrace() === sbrace(_->xxx()) hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java line 594: > 592: _->builtin_float2bfloat16(), > 593: _->f32Type(parameterName), > 594: _-> declareTypeBFloat16Type("b").space().equals().space().obrace().identifier(parameterName).cbrace().semicolonNl() We can reduce the chances of misaligned braces by leaning into various helpers. I think this becomes something lik .assign(_->fb16Type("b"),_->brace(_->identifier(parameterName)).semicolonNl() .returnKeyword(_->identifier("b").dot().identifier("s").sbrace(_->intConstOne())) hat/core/src/main/java/hat/codebuilders/CodeBuilder.java line 588: > 586: > 587: public final T ushort() { > 588: return typeName("ushort"); u16Type ?????? ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/740#discussion_r2602242543 PR Review Comment: https://git.openjdk.org/babylon/pull/740#discussion_r2602247697 PR Review Comment: https://git.openjdk.org/babylon/pull/740#discussion_r2602255216 PR Review Comment: https://git.openjdk.org/babylon/pull/740#discussion_r2602225819 PR Review Comment: https://git.openjdk.org/babylon/pull/740#discussion_r2602234595 From jfumero at openjdk.org Tue Dec 9 13:31:06 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Tue, 9 Dec 2025 13:31:06 GMT Subject: git: openjdk/babylon: code-reflection: [hat] Type transform between bfloat16 <-> float improved Message-ID: <888903b5-e2a9-41ed-bab9-3bb6f90bafcd@openjdk.org> Changeset: 764e9020 Branch: code-reflection Author: Juan Fumero Date: 2025-12-09 13:28:31 +0000 URL: https://git.openjdk.org/babylon/commit/764e9020b79c39e59e83c24e310d415d485c1fa0 [hat] Type transform between bfloat16 <-> float improved ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLHATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/CodeBuilder.java From jfumero at openjdk.org Tue Dec 9 13:31:36 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Tue, 9 Dec 2025 13:31:36 GMT Subject: [code-reflection] Integrated: [hat] Type transform between bfloat16 <-> float improved In-Reply-To: <74Z9vz2EREiL1txgAzl4-UmYaWizCnaj1pXjbQDu7ec=.dceea7e9-16d3-4ff8-bc64-0ed41b7c88f5@github.com> References: <74Z9vz2EREiL1txgAzl4-UmYaWizCnaj1pXjbQDu7ec=.dceea7e9-16d3-4ff8-bc64-0ed41b7c88f5@github.com> Message-ID: On Tue, 9 Dec 2025 10:33:53 GMT, Juan Fumero wrote: > [hat] Type transform between bfloat16 <-> float improved. > > Unittests with the OpenCL backend passing. > CUDA backend not passing due to another error (not related to this PR). We will merge this when we patch the CUDA backed. This pull request has now been integrated. Changeset: 764e9020 Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/764e9020b79c39e59e83c24e310d415d485c1fa0 Stats: 181 lines in 4 files changed: 74 ins; 45 del; 62 mod [hat] Type transform between bfloat16 <-> float improved ------------- PR: https://git.openjdk.org/babylon/pull/740 From jfumero at openjdk.org Tue Dec 9 15:02:54 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Tue, 9 Dec 2025 15:02:54 GMT Subject: [code-reflection] RFR: HAT Test Report improved Message-ID: This PR adds a new exception for those tests in which a precision error is expected (E.g., when converting from float to fp16). It also adds an error code once the unit-tests are finished to facilitate integrated with GitHub actions. How to test: java -cp hat/job.jar hat.java test-suite ffi-opencl java -cp hat/job.jar hat.java test-suite ffi-cuda ------------- Commit messages: - [hat] code-formatter applied - Add error code to test report - Add test_bfloat16_04 into the list - [hat] tests with prec. errors identified - [hat] test report with precision errors as expected fails - [hat] test report with precision errors as expected fails Changes: https://git.openjdk.org/babylon/pull/742/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=742&range=00 Stats: 235 lines in 25 files changed: 113 ins; 11 del; 111 mod Patch: https://git.openjdk.org/babylon/pull/742.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/742/head:pull/742 PR: https://git.openjdk.org/babylon/pull/742 From jfumero at openjdk.org Tue Dec 9 15:16:33 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Tue, 9 Dec 2025 15:16:33 GMT Subject: [code-reflection] Integrated: HAT Test Report improved In-Reply-To: References: Message-ID: On Tue, 9 Dec 2025 14:56:56 GMT, Juan Fumero wrote: > This PR adds a new exception for those tests in which a precision error is expected (E.g., when converting from float to fp16). It also adds an error code once the unit-tests are finished to facilitate integrated with GitHub actions. > > How to test: > > java -cp hat/job.jar hat.java test-suite ffi-opencl > java -cp hat/job.jar hat.java test-suite ffi-cuda This pull request has now been integrated. Changeset: 910d14c8 Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/910d14c8d1e90e4024f6f06e70c2553f74306f3b Stats: 235 lines in 25 files changed: 113 ins; 11 del; 111 mod HAT Test Report improved ------------- PR: https://git.openjdk.org/babylon/pull/742 From jfumero at openjdk.org Tue Dec 9 15:19:16 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Tue, 9 Dec 2025 15:19:16 GMT Subject: git: openjdk/babylon: code-reflection: HAT Test Report improved Message-ID: Changeset: 910d14c8 Branch: code-reflection Author: Juan Fumero Date: 2025-12-09 15:13:18 +0000 URL: https://git.openjdk.org/babylon/commit/910d14c8d1e90e4024f6f06e70c2553f74306f3b HAT Test Report improved ! hat/hat.java ! hat/tests/src/main/java/hat/test/TestArrayView.java ! hat/tests/src/main/java/hat/test/TestArrays.java ! hat/tests/src/main/java/hat/test/TestBFloat16Type.java ! hat/tests/src/main/java/hat/test/TestBlackscholes.java ! hat/tests/src/main/java/hat/test/TestConstants.java ! hat/tests/src/main/java/hat/test/TestDeviceType.java ! hat/tests/src/main/java/hat/test/TestF16Type.java ! hat/tests/src/main/java/hat/test/TestFloat2.java ! hat/tests/src/main/java/hat/test/TestLocal.java ! hat/tests/src/main/java/hat/test/TestMandel.java ! hat/tests/src/main/java/hat/test/TestMatMul.java ! hat/tests/src/main/java/hat/test/TestNbody.java ! hat/tests/src/main/java/hat/test/TestParenthesis.java ! hat/tests/src/main/java/hat/test/TestPrivate.java ! hat/tests/src/main/java/hat/test/TestReductions.java ! hat/tests/src/main/java/hat/test/TestVectorArrayView.java ! hat/tests/src/main/java/hat/test/TestVectorTypes.java ! hat/tests/src/main/java/hat/test/engine/HATAsserts.java ! hat/tests/src/main/java/hat/test/engine/HATTestEngine.java ! hat/tests/src/main/java/hat/test/engine/HATTestFormatter.java = hat/tests/src/main/java/hat/test/exceptions/HATAssertionError.java = hat/tests/src/main/java/hat/test/exceptions/HATExpectedFailureException.java + hat/tests/src/main/java/hat/test/exceptions/HATExpectedPrecisionError.java = hat/tests/src/main/java/hat/test/exceptions/HATTestException.java From gfrost at openjdk.org Tue Dec 9 15:53:40 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 9 Dec 2025 15:53:40 GMT Subject: [code-reflection] Integrated: More C99 code gen fixes Message-ID: Fixes missing semicolon at end of struct which broke CUDA backend. Removed extra '\n' at the end of generated forLoop() Previous fix aggressively impacted all users of semicolonNlSeparated(). Moved primitive typecheck to OpTk ------------- Commit messages: - More C99 code gen fixes Changes: https://git.openjdk.org/babylon/pull/743/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=743&range=00 Stats: 27 lines in 6 files changed: 15 ins; 3 del; 9 mod Patch: https://git.openjdk.org/babylon/pull/743.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/743/head:pull/743 PR: https://git.openjdk.org/babylon/pull/743 From gfrost at openjdk.org Tue Dec 9 15:53:41 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 9 Dec 2025 15:53:41 GMT Subject: [code-reflection] Integrated: More C99 code gen fixes In-Reply-To: References: Message-ID: On Tue, 9 Dec 2025 15:45:49 GMT, Gary Frost wrote: > Fixes missing semicolon at end of struct which broke CUDA backend. > > Removed extra '\n' at the end of generated forLoop() > > Previous fix aggressively impacted all users of semicolonNlSeparated(). > > Moved primitive typecheck to OpTk This pull request has now been integrated. Changeset: 2dbfd51b Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/2dbfd51bc417e00bdee92596e1ea6873f084846c Stats: 27 lines in 6 files changed: 15 ins; 3 del; 9 mod More C99 code gen fixes ------------- PR: https://git.openjdk.org/babylon/pull/743 From gfrost at openjdk.org Tue Dec 9 15:54:30 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 9 Dec 2025 15:54:30 GMT Subject: git: openjdk/babylon: code-reflection: More C99 code gen fixes Message-ID: <8352ef7a-dd7b-4c53-b090-c5d2475a4c5d@openjdk.org> Changeset: 2dbfd51b Branch: code-reflection Author: Gary Frost Date: 2025-12-09 15:49:06 +0000 URL: https://git.openjdk.org/babylon/commit/2dbfd51bc417e00bdee92596e1ea6873f084846c More C99 code gen fixes ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/CodeBuilder.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/intellij/.idea/misc.xml ! hat/intellij/tests.iml From mabbay at openjdk.org Tue Dec 9 16:43:41 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 9 Dec 2025 16:43:41 GMT Subject: [code-reflection] RFR: Fails if code model was compiled by a feature version different from the current [v2] In-Reply-To: <9nk78j8Q4RDPFSyfQ4K9CYcG_o9Z96n3xZv-7K0iF-I=.895417bd-ff5e-4d7e-9128-57480cb65319@github.com> References: <9nk78j8Q4RDPFSyfQ4K9CYcG_o9Z96n3xZv-7K0iF-I=.895417bd-ff5e-4d7e-9128-57480cb65319@github.com> Message-ID: > Before we build a code model, we check if the Java feature version used to compile the code model matches the current one. In case there's no match, we throw an exception. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Apply Paul's comments ------------- Changes: - all: https://git.openjdk.org/babylon/pull/738/files - new: https://git.openjdk.org/babylon/pull/738/files/bfd230e5..325dabd1 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=738&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=738&range=00-01 Stats: 19 lines in 3 files changed: 5 ins; 0 del; 14 mod Patch: https://git.openjdk.org/babylon/pull/738.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/738/head:pull/738 PR: https://git.openjdk.org/babylon/pull/738 From duke at openjdk.org Tue Dec 9 19:25:54 2025 From: duke at openjdk.org (Ruby Chen) Date: Tue, 9 Dec 2025 19:25:54 GMT Subject: [code-reflection] RFR: Add DeviceType support for array views [v2] In-Reply-To: References: Message-ID: > Adding support for both MappableIface and DeviceType to array views. Also shifting the array view phase earlier in the compilation stages. > > Minor refactoring for array view phase. Ruby Chen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision: - Merge branch 'openjdk:code-reflection' into array-view - Add DeviceType support for array views ------------- Changes: - all: https://git.openjdk.org/babylon/pull/732/files - new: https://git.openjdk.org/babylon/pull/732/files/47df325e..8a0727e2 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=732&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=732&range=00-01 Stats: 1530 lines in 50 files changed: 489 ins; 649 del; 392 mod Patch: https://git.openjdk.org/babylon/pull/732.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/732/head:pull/732 PR: https://git.openjdk.org/babylon/pull/732 From psandoz at openjdk.org Tue Dec 9 20:19:40 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Tue, 9 Dec 2025 20:19:40 GMT Subject: [code-reflection] RFR: Fails if code model was compiled by a feature version different from the current [v2] In-Reply-To: References: <9nk78j8Q4RDPFSyfQ4K9CYcG_o9Z96n3xZv-7K0iF-I=.895417bd-ff5e-4d7e-9128-57480cb65319@github.com> Message-ID: On Tue, 9 Dec 2025 16:43:41 GMT, Mourad Abbay wrote: >> Before we build a code model, we check if the Java feature version used to compile the code model matches the current one. In case there's no match, we throw an exception. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Apply Paul's comments Much better. Any thoughts on how to test this? We could modify the bytecode of the class afterwards to replace the constant pool entry with a different version? src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/OpBuilder.java line 179: > 177: J_L_OBJECT); // body definition(s): Body.Builder, List or null > 178: > 179: static final MethodRef STRING_FORMAT = MethodRef.method(String.class, "format", String.class, String.class, Unused. src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/OpBuilder.java line 429: > 427: FuncOp build(String name, Op op) { > 428: Value ancestorBody = builder.op(constant(type(Body.Builder.class), null)); > 429: // check if java version at compile time matches the java version at runtime Now we have the right code shape we could move this to a static helper method rather that repeating the logic. ------------- PR Review: https://git.openjdk.org/babylon/pull/738#pullrequestreview-3559265353 PR Review Comment: https://git.openjdk.org/babylon/pull/738#discussion_r2604011114 PR Review Comment: https://git.openjdk.org/babylon/pull/738#discussion_r2604192181 From psandoz at openjdk.org Tue Dec 9 21:45:29 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Tue, 9 Dec 2025 21:45:29 GMT Subject: [code-reflection] RFR: Rename compute/kernel interfaces. [v2] In-Reply-To: <7xwmEMMYlN6qpzths4ZaMP1xIsVnp0qrEZ0K7AlDcd0=.e4334194-1fd9-4b28-bbe9-67dcd7956db6@github.com> References: <7xwmEMMYlN6qpzths4ZaMP1xIsVnp0qrEZ0K7AlDcd0=.e4334194-1fd9-4b28-bbe9-67dcd7956db6@github.com> Message-ID: > Rename `QuotableComputeContextConsumer` to `Compute` and `QuotableKernelContextConsumer` to `Kernel`. Since we don't have `Quotable` anymore that prefix is redundant. > > Note that the following wil fail to compile since it is a compile time error to annotate the statically qualified type: > > > import hat.Accelerator; > ... > accelerator.compute((@Reflect Accelerator.Compute) > cc -> blackScholes(cc, call, put, S, X, T, r, v)); > > > We need to do this: > > > import hat.Accelerator; > import hat.Accelerator.Compute > ... > accelerator.compute((@Reflect Compute) > cc -> blackScholes(cc, call, put, S, X, T, r, v)); > > > This could motivate making `Compute` a top-level FI. Paul Sandoz has updated the pull request incrementally with one additional commit since the last revision: Rename to Compute and Kernel. ------------- Changes: - all: https://git.openjdk.org/babylon/pull/739/files - new: https://git.openjdk.org/babylon/pull/739/files/01ddd40f..37ff8168 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=739&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=739&range=00-01 Stats: 85 lines in 24 files changed: 0 ins; 5 del; 80 mod Patch: https://git.openjdk.org/babylon/pull/739.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/739/head:pull/739 PR: https://git.openjdk.org/babylon/pull/739 From psandoz at openjdk.org Tue Dec 9 23:21:07 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Tue, 9 Dec 2025 23:21:07 GMT Subject: [code-reflection] RFR: ModuleOp generation from LambdaOp and FuncOp [v8] In-Reply-To: <3WwdNYNnbdiOSjw1UqHcQy18dkn1orWyvdu_aX8Rb1Q=.94be8993-2667-4f2e-8da7-32c0c907ef22@github.com> References: <3WwdNYNnbdiOSjw1UqHcQy18dkn1orWyvdu_aX8Rb1Q=.94be8993-2667-4f2e-8da7-32c0c907ef22@github.com> Message-ID: On Tue, 9 Dec 2025 01:08:10 GMT, Ruby Chen wrote: >> Add support for generating a ModuleOp from either a LambdaOp or a FuncOp. The given LambdaOp will be converted into the root FuncOp, and the given FuncOp will be assigned as the root FuncOp. >> >> For `CoreOp.ModuleOp.ofLambdaOp()`, a unique name for the new root FuncOp must be passed as a parameter. > > Ruby Chen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision: > > - fixes > - Merge branch 'openjdk:code-reflection' into module-op-support > - fixed tests > - Merge branch 'openjdk:code-reflection' into module-op-support > - Add tests > - Merge branch 'openjdk:code-reflection' into module-op-support > - removing commented code > - Suggested changes > - Merge branch 'openjdk:code-reflection' into module-op-support > - Merge branch 'openjdk:code-reflection' into module-op-support > - ... and 2 more: https://git.openjdk.org/babylon/compare/c18d7cec...e70019bf src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/core/CoreOp.java line 370: > 368: temp.add(funcOp); > 369: Op.Result result = blockBuilder.op(CoreOp.funcCall( > 370: iop.invokeDescriptor().name(), The name of the func to call differs from the transformed func's name, so the model you create is incorrect. You need to test more robustly e.g., run through the interpreter or compare text output. src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java line 337: > 335: * Such a lambda operation is one with the following constraints: > 336: *
      > 337: *
    1. Zero or one captured value (assuming correspondence to the {@code this} variable). That is too restrictive. For method references they may or may not capture `this`, but for a direct invocation there will be captures e.g., the optimization pattern in HAT is a lambda expression that makes a direct call to another method, capturing variables and passing then on as arguments to the method. So you need to test out those cases with mixture of lambda parameters and captured variables. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/691#discussion_r2604662572 PR Review Comment: https://git.openjdk.org/babylon/pull/691#discussion_r2604579846 From jfumero at openjdk.org Wed Dec 10 08:53:13 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 10 Dec 2025 08:53:13 GMT Subject: [code-reflection] RFR: [hat] Assert moved to hat.test.exceptions package Message-ID: HATAsserts is moved to exceptions package within the testing framework. ------------- Commit messages: - [hat] Assert moved to hat.test.exceptions package Changes: https://git.openjdk.org/babylon/pull/744/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=744&range=00 Stats: 10 lines in 2 files changed: 1 ins; 9 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/744.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/744/head:pull/744 PR: https://git.openjdk.org/babylon/pull/744 From jfumero at openjdk.org Wed Dec 10 09:06:36 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 10 Dec 2025 09:06:36 GMT Subject: [code-reflection] RFR: [hat] Assert moved to hat.test.exceptions package [v2] In-Reply-To: References: Message-ID: > HATAsserts is moved to exceptions package within the testing framework. Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: Internal HAT-test script updated ------------- Changes: - all: https://git.openjdk.org/babylon/pull/744/files - new: https://git.openjdk.org/babylon/pull/744/files/b5b6a2ab..8b317048 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=744&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=744&range=00-01 Stats: 19 lines in 1 file changed: 12 ins; 2 del; 5 mod Patch: https://git.openjdk.org/babylon/pull/744.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/744/head:pull/744 PR: https://git.openjdk.org/babylon/pull/744 From jfumero at openjdk.org Wed Dec 10 09:13:17 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 10 Dec 2025 09:13:17 GMT Subject: git: openjdk/babylon: code-reflection: [hat] Assert moved to hat.test.exceptions package Message-ID: <6ce17bb3-cd74-46c9-b069-014cc250e657@openjdk.org> Changeset: d8b67f83 Branch: code-reflection Author: Juan Fumero Date: 2025-12-10 09:11:34 +0000 URL: https://git.openjdk.org/babylon/commit/d8b67f83738201d87ce0eecc02d44dd4e5087368 [hat] Assert moved to hat.test.exceptions package ! hat/hat/test.java ! hat/tests/src/main/java/hat/test/engine/HATTestEngine.java = hat/tests/src/main/java/hat/test/exceptions/HATAsserts.java From jfumero at openjdk.org Wed Dec 10 09:14:08 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 10 Dec 2025 09:14:08 GMT Subject: [code-reflection] Integrated: [hat] Assert moved to hat.test.exceptions package In-Reply-To: References: Message-ID: <9-aOTZQrF8qsqcrEyaAKW9Iw78YHMyEaUePGOuoBzhM=.00840c92-d2c6-4265-9ffd-7d118cb7a1b3@github.com> On Wed, 10 Dec 2025 08:48:08 GMT, Juan Fumero wrote: > HATAsserts is moved to exceptions package within the testing framework. This pull request has now been integrated. Changeset: d8b67f83 Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/d8b67f83738201d87ce0eecc02d44dd4e5087368 Stats: 29 lines in 3 files changed: 13 ins; 11 del; 5 mod [hat] Assert moved to hat.test.exceptions package ------------- PR: https://git.openjdk.org/babylon/pull/744 From mabbay at openjdk.org Wed Dec 10 15:09:45 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 10 Dec 2025 15:09:45 GMT Subject: [code-reflection] RFR: Fails if code model was compiled by a feature version different from the current [v3] In-Reply-To: <9nk78j8Q4RDPFSyfQ4K9CYcG_o9Z96n3xZv-7K0iF-I=.895417bd-ff5e-4d7e-9128-57480cb65319@github.com> References: <9nk78j8Q4RDPFSyfQ4K9CYcG_o9Z96n3xZv-7K0iF-I=.895417bd-ff5e-4d7e-9128-57480cb65319@github.com> Message-ID: <_wBRjeQthPbQsOcbPQ9AZ5_aJvlutro5S5D6RbyPkrk=.b0e958c8-af80-40d5-859d-0d1396583531@github.com> > Before we build a code model, we check if the Java feature version used to compile the code model matches the current one. In case there's no match, we throw an exception. Mourad Abbay has updated the pull request incrementally with two additional commits since the last revision: - Encapsulate the logic of checking java version in a helper func - Delete unused field ------------- Changes: - all: https://git.openjdk.org/babylon/pull/738/files - new: https://git.openjdk.org/babylon/pull/738/files/325dabd1..d3ee0f78 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=738&range=02 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=738&range=01-02 Stats: 46 lines in 1 file changed: 23 ins; 22 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/738.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/738/head:pull/738 PR: https://git.openjdk.org/babylon/pull/738 From psandoz at openjdk.org Wed Dec 10 22:50:28 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 10 Dec 2025 22:50:28 GMT Subject: [code-reflection] Integrated: Rename compute/kernel interfaces. In-Reply-To: <7xwmEMMYlN6qpzths4ZaMP1xIsVnp0qrEZ0K7AlDcd0=.e4334194-1fd9-4b28-bbe9-67dcd7956db6@github.com> References: <7xwmEMMYlN6qpzths4ZaMP1xIsVnp0qrEZ0K7AlDcd0=.e4334194-1fd9-4b28-bbe9-67dcd7956db6@github.com> Message-ID: On Mon, 8 Dec 2025 23:40:37 GMT, Paul Sandoz wrote: > Rename `QuotableComputeContextConsumer` to `Compute` and `QuotableKernelContextConsumer` to `Kernel`. Since we don't have `Quotable` anymore that prefix is redundant. > > Note that the following wil fail to compile since it is a compile time error to annotate the statically qualified type: > > > import hat.Accelerator; > ... > accelerator.compute((@Reflect Accelerator.Compute) > cc -> blackScholes(cc, call, put, S, X, T, r, v)); > > > We need to do this: > > > import hat.Accelerator; > import hat.Accelerator.Compute > ... > accelerator.compute((@Reflect Compute) > cc -> blackScholes(cc, call, put, S, X, T, r, v)); > > > This could motivate making `Compute` a top-level FI. This pull request has now been integrated. Changeset: 4bf33c66 Author: Paul Sandoz URL: https://git.openjdk.org/babylon/commit/4bf33c6637b86dcd04512370701e032a82d3c7db Stats: 131 lines in 27 files changed: 3 ins; 12 del; 116 mod Rename compute/kernel interfaces. ------------- PR: https://git.openjdk.org/babylon/pull/739 From psandoz at openjdk.org Wed Dec 10 22:52:49 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 10 Dec 2025 22:52:49 GMT Subject: git: openjdk/babylon: code-reflection: Rename compute/kernel interfaces. Message-ID: <1a19b857-a947-4522-a8f0-fd4c024d06c9@openjdk.org> Changeset: 4bf33c66 Branch: code-reflection Author: Paul Sandoz Date: 2025-12-10 22:48:02 +0000 URL: https://git.openjdk.org/babylon/commit/4bf33c6637b86dcd04512370701e032a82d3c7db Rename compute/kernel interfaces. ! hat/core/src/main/java/hat/Accelerator.java ! hat/core/src/main/java/hat/ComputeContext.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/test/hat/SquaresTest.java ! hat/docs/hat-05-accelerator-compute.md ! hat/examples/blackscholes/src/main/java/blackscholes/Main.java ! hat/examples/experiments/src/main/java/experiments/ForTests.java ! hat/examples/experiments/src/main/java/experiments/LocalArray.java ! hat/examples/experiments/src/main/java/experiments/LocalIds.java ! hat/examples/experiments/src/main/java/experiments/Mesh.java ! hat/examples/experiments/src/main/java/experiments/MinBufferTest.java ! hat/examples/experiments/src/main/java/experiments/PrefixSum.java ! hat/examples/experiments/src/main/java/experiments/QuotedArrayArg.java ! hat/examples/experiments/src/main/java/experiments/QuotedConstantArgs.java ! hat/examples/experiments/src/main/java/experiments/Reduction.java ! hat/examples/experiments/src/main/java/experiments/spirv/Bad.java ! hat/examples/experiments/src/main/java/experiments/spirv/GetBackend.java ! hat/examples/experiments/src/main/java/experiments/spirv/MatrixMultiply.java = hat/examples/heal/src/main/java/heal/ComputeHeal.java ! hat/examples/heal/src/main/java/heal/Viewer.java ! hat/examples/life/src/main/java/life/Main.java ! hat/examples/mandel/src/main/java/mandel/Main.java ! hat/examples/matmul/src/main/java/matmul/Main.java ! hat/examples/nbody/src/main/java/nbody/opencl/OpenCLNBodyGLWindow.java ! hat/examples/squares/src/main/java/squares/Main.java ! hat/examples/violajones/src/main/java/violajones/Main.java ! hat/tests/src/main/java/hat/test/TestArrayView.java From psandoz at openjdk.org Wed Dec 10 23:14:41 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 10 Dec 2025 23:14:41 GMT Subject: git: openjdk/babylon: code-reflection: Remove CodeElement.transform Message-ID: Changeset: f971f47b Branch: code-reflection Author: Paul Sandoz Date: 2025-12-10 23:13:18 +0000 URL: https://git.openjdk.org/babylon/commit/f971f47b358f7d50b765529b02bfef3a0ca67104 Remove CodeElement.transform ! cr-examples/onnx/src/main/java/oracle/code/onnx/compiler/OnnxTransformer.java ! cr-examples/onnx/src/main/java/oracle/code/onnx/compiler/TypeConvertor.java ! cr-examples/samples/src/main/java/oracle/code/samples/HelloCodeReflection.java ! cr-examples/samples/src/main/java/oracle/code/samples/MathOptimizer.java ! cr-examples/triton/src/main/java/oracle/code/triton/TritonTransformer.java ! hat/core/src/main/java/hat/callgraph/KernelCallGraph.java ! hat/core/src/main/java/hat/optools/OpTk.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/CodeElement.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/analysis/Liveness.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/analysis/Patterns.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/analysis/SSABraun.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/analysis/SSACytron.java ! test/jdk/java/lang/reflect/code/TestBlockParameters.java ! test/jdk/java/lang/reflect/code/TestLiveness.java ! test/jdk/java/lang/reflect/code/TestTraverse.java ! test/jdk/java/lang/reflect/code/TestUsesDependsOn.java ! test/jdk/java/lang/reflect/code/bytecode/lift/SlotToVarTransformer.java ! test/jdk/java/lang/reflect/code/bytecode/lift/UnresolvedTypesTransformer.java ! test/jdk/java/lang/reflect/code/bytecode/lift/Verifier.java ! test/jdk/java/lang/reflect/code/location/TestLocation.java From psandoz at openjdk.org Wed Dec 10 23:18:35 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 10 Dec 2025 23:18:35 GMT Subject: [code-reflection] RFR: Remove CodeElement.transform [v2] In-Reply-To: References: Message-ID: > Remove the `CodeElement.transform` method and the helper methods. Traversal of elements is performed using the `CodeElement.elements` method that returns a stream of code elements. Paul Sandoz has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision: - Merge remote-tracking branch 'upstream/code-reflection' into rm-ce-transform - Remove comments. - Merge remote-tracking branch 'upstream/code-reflection' into rm-ce-transform - Remove CodeElement.transform method. ------------- Changes: - all: https://git.openjdk.org/babylon/pull/737/files - new: https://git.openjdk.org/babylon/pull/737/files/d4c3bb54..6d5444ec Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=737&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=737&range=00-01 Stats: 600 lines in 59 files changed: 217 ins; 78 del; 305 mod Patch: https://git.openjdk.org/babylon/pull/737.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/737/head:pull/737 PR: https://git.openjdk.org/babylon/pull/737 From psandoz at openjdk.org Wed Dec 10 23:18:35 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 10 Dec 2025 23:18:35 GMT Subject: [code-reflection] Integrated: Remove CodeElement.transform In-Reply-To: References: Message-ID: On Mon, 8 Dec 2025 17:54:26 GMT, Paul Sandoz wrote: > Remove the `CodeElement.transform` method and the helper methods. Traversal of elements is performed using the `CodeElement.elements` method that returns a stream of code elements. This pull request has now been integrated. Changeset: f971f47b Author: Paul Sandoz URL: https://git.openjdk.org/babylon/commit/f971f47b358f7d50b765529b02bfef3a0ca67104 Stats: 235 lines in 20 files changed: 47 ins; 91 del; 97 mod Remove CodeElement.transform ------------- PR: https://git.openjdk.org/babylon/pull/737 From psandoz at openjdk.org Wed Dec 10 23:29:38 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 10 Dec 2025 23:29:38 GMT Subject: [code-reflection] RFR: Fails if code model was compiled by a feature version different from the current [v3] In-Reply-To: <_wBRjeQthPbQsOcbPQ9AZ5_aJvlutro5S5D6RbyPkrk=.b0e958c8-af80-40d5-859d-0d1396583531@github.com> References: <9nk78j8Q4RDPFSyfQ4K9CYcG_o9Z96n3xZv-7K0iF-I=.895417bd-ff5e-4d7e-9128-57480cb65319@github.com> <_wBRjeQthPbQsOcbPQ9AZ5_aJvlutro5S5D6RbyPkrk=.b0e958c8-af80-40d5-859d-0d1396583531@github.com> Message-ID: On Wed, 10 Dec 2025 15:09:45 GMT, Mourad Abbay wrote: >> Before we build a code model, we check if the Java feature version used to compile the code model matches the current one. In case there's no match, we throw an exception. > > Mourad Abbay has updated the pull request incrementally with two additional commits since the last revision: > > - Encapsulate the logic of checking java version in a helper func > - Delete unused field We can work out how to test this in a subsequent PR. ------------- Marked as reviewed by psandoz (Lead). PR Review: https://git.openjdk.org/babylon/pull/738#pullrequestreview-3564908271 From mabbay at openjdk.org Thu Dec 11 00:15:25 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Thu, 11 Dec 2025 00:15:25 GMT Subject: git: openjdk/babylon: code-reflection: Fails if code model was compiled by a feature version different from the current Message-ID: Changeset: e529f177 Branch: code-reflection Author: Mourad Abbay Date: 2025-12-11 00:13:01 +0000 URL: https://git.openjdk.org/babylon/commit/e529f17778a40d27835ab7fcd0b6e89f4d53a44f Fails if code model was compiled by a feature version different from the current Reviewed-by: psandoz ! src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/OpBuilder.java From mabbay at openjdk.org Thu Dec 11 00:15:37 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Thu, 11 Dec 2025 00:15:37 GMT Subject: [code-reflection] Integrated: Fails if code model was compiled by a feature version different from the current In-Reply-To: <9nk78j8Q4RDPFSyfQ4K9CYcG_o9Z96n3xZv-7K0iF-I=.895417bd-ff5e-4d7e-9128-57480cb65319@github.com> References: <9nk78j8Q4RDPFSyfQ4K9CYcG_o9Z96n3xZv-7K0iF-I=.895417bd-ff5e-4d7e-9128-57480cb65319@github.com> Message-ID: On Mon, 8 Dec 2025 19:32:49 GMT, Mourad Abbay wrote: > Before we build a code model, we check if the Java feature version used to compile the code model matches the current one. In case there's no match, we throw an exception. This pull request has now been integrated. Changeset: e529f177 Author: Mourad Abbay URL: https://git.openjdk.org/babylon/commit/e529f17778a40d27835ab7fcd0b6e89f4d53a44f Stats: 46 lines in 3 files changed: 46 ins; 0 del; 0 mod Fails if code model was compiled by a feature version different from the current Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/738 From psandoz at openjdk.org Thu Dec 11 19:58:12 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 11 Dec 2025 19:58:12 GMT Subject: [babylon-docs:master] Integrated: Triton doc updates. Message-ID: Triton doc updates. ------------- Commit messages: - Triton doc updates. Changes: https://git.openjdk.org/babylon-docs/pull/12/files Webrev: https://webrevs.openjdk.org/?repo=babylon-docs&pr=12&range=00 Stats: 272 lines in 1 file changed: 5 ins; 16 del; 251 mod Patch: https://git.openjdk.org/babylon-docs/pull/12.diff Fetch: git fetch https://git.openjdk.org/babylon-docs.git pull/12/head:pull/12 PR: https://git.openjdk.org/babylon-docs/pull/12 From psandoz at openjdk.org Thu Dec 11 19:58:13 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 11 Dec 2025 19:58:13 GMT Subject: [babylon-docs:master] Integrated: Triton doc updates. In-Reply-To: References: Message-ID: On Thu, 11 Dec 2025 19:52:11 GMT, Paul Sandoz wrote: > Triton doc updates. This pull request has now been integrated. Changeset: fed2a84f Author: Paul Sandoz URL: https://git.openjdk.org/babylon-docs/commit/fed2a84fb662e4db9179d72b663435e76a38f044 Stats: 272 lines in 1 file changed: 5 ins; 16 del; 251 mod Triton doc updates. ------------- PR: https://git.openjdk.org/babylon-docs/pull/12 From duke at openjdk.org Thu Dec 11 20:00:50 2025 From: duke at openjdk.org (Ruby Chen) Date: Thu, 11 Dec 2025 20:00:50 GMT Subject: [code-reflection] RFR: Add DeviceType support for array views [v3] In-Reply-To: References: Message-ID: > Adding support for both MappableIface and DeviceType to array views. Also shifting the array view phase earlier in the compilation stages. > > Minor refactoring for array view phase. Ruby Chen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: - Merge branch 'openjdk:code-reflection' into array-view - Merge branch 'openjdk:code-reflection' into array-view - Add DeviceType support for array views ------------- Changes: - all: https://git.openjdk.org/babylon/pull/732/files - new: https://git.openjdk.org/babylon/pull/732/files/8a0727e2..b9facd6c Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=732&range=02 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=732&range=01-02 Stats: 441 lines in 52 files changed: 109 ins; 114 del; 218 mod Patch: https://git.openjdk.org/babylon/pull/732.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/732/head:pull/732 PR: https://git.openjdk.org/babylon/pull/732 From duke at openjdk.org Thu Dec 11 20:06:48 2025 From: duke at openjdk.org (Ruby Chen) Date: Thu, 11 Dec 2025 20:06:48 GMT Subject: [code-reflection] RFR: Add DeviceType support for array views [v4] In-Reply-To: References: Message-ID: > Adding support for both MappableIface and DeviceType to array views. Also shifting the array view phase earlier in the compilation stages. > > Minor refactoring for array view phase. Ruby Chen has updated the pull request incrementally with one additional commit since the last revision: Added tests ------------- Changes: - all: https://git.openjdk.org/babylon/pull/732/files - new: https://git.openjdk.org/babylon/pull/732/files/b9facd6c..73cf6b4e Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=732&range=03 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=732&range=02-03 Stats: 236 lines in 2 files changed: 166 ins; 68 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/732.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/732/head:pull/732 PR: https://git.openjdk.org/babylon/pull/732 From duke at openjdk.org Thu Dec 11 20:06:51 2025 From: duke at openjdk.org (duke) Date: Thu, 11 Dec 2025 20:06:51 GMT Subject: [code-reflection] RFR: Add DeviceType support for array views [v3] In-Reply-To: References: Message-ID: On Thu, 11 Dec 2025 20:00:50 GMT, Ruby Chen wrote: >> Adding support for both MappableIface and DeviceType to array views. Also shifting the array view phase earlier in the compilation stages. >> >> Minor refactoring for array view phase. > > Ruby Chen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: > > - Merge branch 'openjdk:code-reflection' into array-view > - Merge branch 'openjdk:code-reflection' into array-view > - Add DeviceType support for array views @rbrchen Your change (at version 73cf6b4e03cc786a09e4d641949ed100912212dd) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/732#issuecomment-3643586081 From jfumero at openjdk.org Fri Dec 12 11:40:44 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Fri, 12 Dec 2025 11:40:44 GMT Subject: [code-reflection] RFR: HAT memory mallocs and copies improved Message-ID: Use of `MappableIface` annotations to tag the buffer accessor for OpenCL. In addition, this PR reuses buffers attach to each dispatch and copies the data that is needed. For OpenCL and macOS, this PR in HAT increases performance of up to 30% end-to-end time (including data movement). Buffer accessors are not available for CUDA, but the CUDA runtime in HAT minimizes the transfers as well as cuda allocations. How to test? All unit-tests should be passing: java @hat/test-suite ffi-opencl Run violajones: HAT=MINIMIZE_COPIES java -cp hat/job.jar hat.java run ffi-opencl -Dheadless=true violajones ``` Run GoL: java @hat/run ffi-opencl life ------------- Commit messages: - Merge branch 'code-reflection' into hat/memory/accessors - [hat] using the same type for accessors - [hat] improving data handler and transfers - [hat] cuda buffer allocs and copies minimized - [hat][wip] Improvements MemAlloc and data copies Changes: https://git.openjdk.org/babylon/pull/746/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=746&range=00 Stats: 120 lines in 15 files changed: 24 ins; 22 del; 74 mod Patch: https://git.openjdk.org/babylon/pull/746.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/746/head:pull/746 PR: https://git.openjdk.org/babylon/pull/746 From jfumero at openjdk.org Fri Dec 12 11:54:25 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Fri, 12 Dec 2025 11:54:25 GMT Subject: [code-reflection] RFR: Add DeviceType support for array views [v4] In-Reply-To: References: Message-ID: On Thu, 11 Dec 2025 20:06:48 GMT, Ruby Chen wrote: >> Adding support for both MappableIface and DeviceType to array views. Also shifting the array view phase earlier in the compilation stages. >> >> Minor refactoring for array view phase. > > Ruby Chen has updated the pull request incrementally with one additional commit since the last revision: > > Added tests Thanks Ruby. All tests passing now. I think this version does not need the records `ArrayAccessInfo` and `Node` and the methods associated with it. Any reason to keep them? ------------- PR Review: https://git.openjdk.org/babylon/pull/732#pullrequestreview-3571522537 From jfumero at openjdk.org Fri Dec 12 12:14:51 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Fri, 12 Dec 2025 12:14:51 GMT Subject: [code-reflection] RFR: HAT memory mallocs and copies improved [v2] In-Reply-To: References: Message-ID: > Use of `MappableIface` annotations to tag the buffer accessor for OpenCL. > In addition, this PR reuses buffers attach to each dispatch and copies the data that is needed. > > For OpenCL and macOS, this PR in HAT increases performance of up to 30% end-to-end time (including data movement). > > Buffer accessors are not available for CUDA, but the CUDA runtime in HAT minimizes the transfers as well as cuda allocations. > > How to test? All unit-tests should be passing: > > > java @hat/test-suite ffi-opencl > > > Run violajones: > > > HAT=MINIMIZE_COPIES java -cp hat/job.jar hat.java run ffi-opencl -Dheadless=true violajones > ``` > > Run GoL: > > > java @hat/run ffi-opencl life Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: [hat] life-example revert control to RO ------------- Changes: - all: https://git.openjdk.org/babylon/pull/746/files - new: https://git.openjdk.org/babylon/pull/746/files/654d1b53..fe11189a Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=746&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=746&range=00-01 Stats: 3 lines in 1 file changed: 0 ins; 1 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/746.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/746/head:pull/746 PR: https://git.openjdk.org/babylon/pull/746 From jfumero at openjdk.org Fri Dec 12 13:11:54 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Fri, 12 Dec 2025 13:11:54 GMT Subject: git: openjdk/babylon: code-reflection: HAT memory mallocs and copies improved Message-ID: <3181a678-8396-45f5-bea1-a54445391f1d@openjdk.org> Changeset: df6fb50e Branch: code-reflection Author: Juan Fumero Date: 2025-12-12 13:09:43 +0000 URL: https://git.openjdk.org/babylon/commit/df6fb50ec25517c19838fecc2ae6a6ebcb009849 HAT memory mallocs and copies improved ! hat/backends/ffi/cuda/src/main/native/cpp/cuda_backend.cpp ! hat/backends/ffi/cuda/src/main/native/cpp/cuda_backend_buffer.cpp ! hat/backends/ffi/cuda/src/main/native/include/cuda_backend.h ! hat/backends/ffi/mock/src/main/native/cpp/mock_backend.cpp ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLBackend.java ! hat/backends/ffi/opencl/src/main/native/cpp/opencl_backend.cpp ! hat/backends/ffi/opencl/src/main/native/cpp/opencl_backend_buffer.cpp ! hat/backends/ffi/opencl/src/main/native/include/opencl_backend.h ! hat/backends/ffi/shared/src/main/native/cpp/shared.cpp ! hat/backends/ffi/shared/src/main/native/include/shared.h ! hat/examples/life/src/main/java/life/Main.java ! hat/examples/matmul/src/main/java/matmul/Main.java ! hat/examples/violajones/src/main/java/violajones/ViolaJonesCoreCompute.java ! hat/tests/src/main/java/hat/test/TestBFloat16Type.java ! hat/tests/src/main/java/hat/test/TestF16Type.java From jfumero at openjdk.org Fri Dec 12 13:12:29 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Fri, 12 Dec 2025 13:12:29 GMT Subject: [code-reflection] Integrated: HAT memory mallocs and copies improved In-Reply-To: References: Message-ID: On Fri, 12 Dec 2025 11:33:56 GMT, Juan Fumero wrote: > Use of `MappableIface` annotations to tag the buffer accessor for OpenCL. > In addition, this PR reuses buffers attach to each dispatch and copies the data that is needed. > > For OpenCL and macOS, this PR in HAT increases performance of up to 30% end-to-end time (including data movement). > > Buffer accessors are not available for CUDA, but the CUDA runtime in HAT minimizes the transfers as well as cuda allocations. > > How to test? All unit-tests should be passing: > > > java @hat/test-suite ffi-opencl > > > Run violajones: > > > HAT=MINIMIZE_COPIES java -cp hat/job.jar hat.java run ffi-opencl -Dheadless=true violajones > ``` > > Run GoL: > > > java @hat/run ffi-opencl life This pull request has now been integrated. Changeset: df6fb50e Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/df6fb50ec25517c19838fecc2ae6a6ebcb009849 Stats: 117 lines in 15 files changed: 23 ins; 22 del; 72 mod HAT memory mallocs and copies improved ------------- PR: https://git.openjdk.org/babylon/pull/746 From asotona at openjdk.org Fri Dec 12 14:07:10 2025 From: asotona at openjdk.org (Adam Sotona) Date: Fri, 12 Dec 2025 14:07:10 GMT Subject: [code-reflection] RFR: 8373576: BytecodeGenerator fails with AssertionError on InvokeOp with varargs Message-ID: The first operand of a static vararg method invocation is wrongly identified as the first operand on stack for the following bytecode instruction. However several bytecode instructions prepend the operand use, so the operand presence on the stack must be deferred. ------------- Commit messages: - 8373576: BytecodeGenerator fails with AssertionError on InvokeOp with varargs Changes: https://git.openjdk.org/babylon/pull/747/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=747&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8373576 Stats: 8 lines in 2 files changed: 8 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/747.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/747/head:pull/747 PR: https://git.openjdk.org/babylon/pull/747 From gfrost at openjdk.org Fri Dec 12 17:34:25 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 12 Dec 2025 17:34:25 GMT Subject: [code-reflection] RFR: HAT memory mallocs and copies improved [v2] In-Reply-To: References: Message-ID: On Fri, 12 Dec 2025 12:14:51 GMT, Juan Fumero wrote: >> Use of `MappableIface` annotations to tag the buffer accessor for OpenCL. >> In addition, this PR reuses buffers attach to each dispatch and copies the data that is needed. >> >> For OpenCL and macOS, this PR in HAT increases performance of up to 30% end-to-end time (including data movement). >> >> Buffer accessors are not available for CUDA, but the CUDA runtime in HAT minimizes the transfers as well as cuda allocations. >> >> How to test? All unit-tests should be passing: >> >> >> java @hat/test-suite ffi-opencl >> >> >> Run violajones: >> >> >> HAT=MINIMIZE_COPIES java -cp hat/job.jar hat.java run ffi-opencl -Dheadless=true violajones >> ``` >> >> Run GoL: >> >> >> java @hat/run ffi-opencl life > > Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: > > [hat] life-example revert control to RO hat/backends/ffi/cuda/src/main/native/cpp/cuda_backend.cpp line 366: > 364: CudaBackend::CudaBuffer *CudaBackend::getOrCreateBuffer(BufferState *bufferState, u8_t accessor) { > 365: CudaBuffer *cudaBuffer = nullptr; > 366: if (bufferState->vendorPtr == nullptr || bufferState->state == BufferState::NEW_STATE) { So I understand we are embedding the access (RO|WO etc) in the buffer... we get this access from the arg slot info (RO|WO etc) and then putting this in the memory segment.. What if we pass this to another kernel whose access is different? ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/746#discussion_r2615045605 From duke at openjdk.org Fri Dec 12 18:07:05 2025 From: duke at openjdk.org (Ruby Chen) Date: Fri, 12 Dec 2025 18:07:05 GMT Subject: [code-reflection] RFR: Add DeviceType support for array views [v5] In-Reply-To: References: Message-ID: > Adding support for both MappableIface and DeviceType to array views. Also shifting the array view phase earlier in the compilation stages. > > Minor refactoring for array view phase. Ruby Chen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision: - Removed more code - Merge branch 'openjdk:code-reflection' into array-view - Added tests - Merge branch 'openjdk:code-reflection' into array-view - Merge branch 'openjdk:code-reflection' into array-view - Add DeviceType support for array views ------------- Changes: - all: https://git.openjdk.org/babylon/pull/732/files - new: https://git.openjdk.org/babylon/pull/732/files/73cf6b4e..56af3150 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=732&range=04 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=732&range=03-04 Stats: 184 lines in 16 files changed: 23 ins; 89 del; 72 mod Patch: https://git.openjdk.org/babylon/pull/732.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/732/head:pull/732 PR: https://git.openjdk.org/babylon/pull/732 From duke at openjdk.org Fri Dec 12 18:07:07 2025 From: duke at openjdk.org (Ruby Chen) Date: Fri, 12 Dec 2025 18:07:07 GMT Subject: [code-reflection] RFR: Add DeviceType support for array views [v4] In-Reply-To: References: Message-ID: On Thu, 11 Dec 2025 20:06:48 GMT, Ruby Chen wrote: >> Adding support for both MappableIface and DeviceType to array views. Also shifting the array view phase earlier in the compilation stages. >> >> Minor refactoring for array view phase. > > Ruby Chen has updated the pull request incrementally with one additional commit since the last revision: > > Added tests Hi Juan! No reason to keep them :) Just removed those plus a few other methods that won't be used anymore - thanks for catching that! ------------- PR Comment: https://git.openjdk.org/babylon/pull/732#issuecomment-3647573220 From duke at openjdk.org Fri Dec 12 18:07:08 2025 From: duke at openjdk.org (duke) Date: Fri, 12 Dec 2025 18:07:08 GMT Subject: [code-reflection] RFR: Add DeviceType support for array views [v4] In-Reply-To: References: Message-ID: <0WnL-Venvx1LjodjmrB21T4Ch8BqXF9PaQ394TcnWvw=.8ec109f2-4174-41be-8d58-191bb83036ed@github.com> On Thu, 11 Dec 2025 20:06:48 GMT, Ruby Chen wrote: >> Adding support for both MappableIface and DeviceType to array views. Also shifting the array view phase earlier in the compilation stages. >> >> Minor refactoring for array view phase. > > Ruby Chen has updated the pull request incrementally with one additional commit since the last revision: > > Added tests @rbrchen Your change (at version 56af3150e6b52e547132f63e296b92896dbd7d2d) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/732#issuecomment-3647578847 From gfrost at openjdk.org Fri Dec 12 18:20:19 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 12 Dec 2025 18:20:19 GMT Subject: git: openjdk/babylon: code-reflection: Add DeviceType support for array views Message-ID: <64d16cd9-06af-4d1d-a0a3-75b87406085e@openjdk.org> Changeset: 486841fc Branch: code-reflection Author: Ruby Chen Committer: Gary Frost Date: 2025-12-12 18:17:03 +0000 URL: https://git.openjdk.org/babylon/commit/486841fc7ed1651e5372651c4d69ad022a8540de Add DeviceType support for array views ! hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyTier.java ! hat/tests/src/main/java/hat/test/TestArrayView.java From duke at openjdk.org Fri Dec 12 18:20:25 2025 From: duke at openjdk.org (Ruby Chen) Date: Fri, 12 Dec 2025 18:20:25 GMT Subject: [code-reflection] Integrated: Add DeviceType support for array views In-Reply-To: References: Message-ID: On Mon, 8 Dec 2025 02:10:48 GMT, Ruby Chen wrote: > Adding support for both MappableIface and DeviceType to array views. Also shifting the array view phase earlier in the compilation stages. > > Minor refactoring for array view phase. This pull request has now been integrated. Changeset: 486841fc Author: Ruby Chen Committer: Gary Frost URL: https://git.openjdk.org/babylon/commit/486841fc7ed1651e5372651c4d69ad022a8540de Stats: 367 lines in 3 files changed: 209 ins; 71 del; 87 mod Add DeviceType support for array views ------------- PR: https://git.openjdk.org/babylon/pull/732 From mabbay at openjdk.org Fri Dec 12 18:59:58 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 12 Dec 2025 18:59:58 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods Message-ID: Write test to make sure java version check we do before building models is working. There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. ------------- Commit messages: - Write test for $checkJavaVersion Changes: https://git.openjdk.org/babylon/pull/748/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=748&range=00 Stats: 115 lines in 1 file changed: 115 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/748.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/748/head:pull/748 PR: https://git.openjdk.org/babylon/pull/748 From nadeeshtv at gmail.com Sat Dec 13 17:22:04 2025 From: nadeeshtv at gmail.com (nadeesh t v) Date: Sat, 13 Dec 2025 18:22:04 +0100 Subject: Some minor errors observed in while experimenting with a sample Message-ID: Hello, I was experimenting with a HAT Squares sample () and noticed a couple of minor issues ( at least I think). Since this is still in the development stage, I am not sure whether it?s right to bring it up or not. Let me know if these kinds of minor issues should not be brought up or not. I was using the *OpenCL* backend. 1 I can mark the argument of kernel function with any one of the RO/RW annotations and still seem to work. For eg: in the original example it was* void squareKernel(@RO KernelContext kc, @RW S32Array array)* But if I change that to `*void squareKernel(@WO KernelContext kc, @RO S32Array array)* `, it still works. I would expect it to throw some errors because the access byte has changed. 2 If I add a *System.out.println("Hello")* in the kernel, it is running to the below issue. ``` *@Reflect* *public static void squareKernel(@WO KernelContext kc, @RO S32Array array) {* * System.out.println("Hello");* * if (kc.gix < kc.gsx){* * ?.* * }* * }* ``` Is there some rule about what should go into the kernel function? ``` *what?org.example.MainWithHAT::squareKernel(hat.KernelContext, hat.buffer.S32Array):void java.lang.IllegalStateException: What is this field load ?jdk.incubator.code.dialect.java.JavaOp$FieldAccessOp$FieldLoadOp at 1fc32e4fjava.lang.IllegalStateException: What is this field load ?jdk.incubator.code.dialect.java.JavaOp$FieldAccessOp$FieldLoadOp at 1fc32e4f* * at hat.codebuilders.C99HATKernelBuilder.fieldLoadOp(C99HATKernelBuilder.java:72)* * at hat.codebuilders.C99HATKernelBuilder.fieldLoadOp(C99HATKernelBuilder.java:58)* ?. ``` 3. If I comment out the *Reflect *on the function that is called from kernel function ``` *// @Reflect* public static int squareit(int v) { return v * v; } ``` Then *,* I am running into the familiar `c` error. ``` *UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed* *buildStatus =failed* *logLen = 186 log = program_source:50:37: error: implicit declaration of function 'squareit' is invalid in OpenCL* * array->array[(long)HAT_GIX]=squareit(value);* ``` 4. If I comment out the *Reflect *on the *compute method* function that is throwing an error from *Optional* but for that I can create a pull request to throw the one similar to the `did you miss @Reflect annotation?`. -- Thanks and Regards, Nadeesh TV -------------- next part -------------- An HTML attachment was scrubbed... URL: From duke at openjdk.org Sun Dec 14 04:58:13 2025 From: duke at openjdk.org (Ruby Chen) Date: Sun, 14 Dec 2025 04:58:13 GMT Subject: [code-reflection] RFR: ModuleOp generation from LambdaOp and FuncOp [v9] In-Reply-To: References: Message-ID: > Add support for generating a ModuleOp from either a LambdaOp or a FuncOp. The given LambdaOp will be converted into the root FuncOp, and the given FuncOp will be assigned as the root FuncOp. > > For `CoreOp.ModuleOp.ofLambdaOp()`, a unique name for the new root FuncOp must be passed as a parameter. Ruby Chen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 14 additional commits since the last revision: - Suggested changes - Merge branch 'openjdk:code-reflection' into module-op-support - fixes - Merge branch 'openjdk:code-reflection' into module-op-support - fixed tests - Merge branch 'openjdk:code-reflection' into module-op-support - Add tests - Merge branch 'openjdk:code-reflection' into module-op-support - removing commented code - Suggested changes - ... and 4 more: https://git.openjdk.org/babylon/compare/7164bb9e...630cb9d0 ------------- Changes: - all: https://git.openjdk.org/babylon/pull/691/files - new: https://git.openjdk.org/babylon/pull/691/files/e70019bf..630cb9d0 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=691&range=08 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=691&range=07-08 Stats: 1422 lines in 96 files changed: 555 ins; 280 del; 587 mod Patch: https://git.openjdk.org/babylon/pull/691.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/691/head:pull/691 PR: https://git.openjdk.org/babylon/pull/691 From gary.frost at oracle.com Mon Dec 15 08:59:32 2025 From: gary.frost at oracle.com (Gary Frost) Date: Mon, 15 Dec 2025 08:59:32 +0000 Subject: Some minor errors observed in while experimenting with a sample In-Reply-To: References: Message-ID: Hello Nadesh. Thanks for checking out HAT and for the feedback. Basicallyference the question numbers in your email in my response. 1) The access annotations for kernel args (and compute args) are currently needed, but will soon be unnecessary. These annotations indicate a contract with the kernel, indicating how the kernel expects to access its 'buffer' args (MemorySegments) . We have code which can determine the access patterns by static analysis of the kernel call tree (a closure over the kernel and all methods reachable from it) and at present we are validating that our analysis matches the annotations. So you should endeavour to annotate corrrectly. Failure to do so, will mean that we will treat it as RW. So we may copy unnecessarily to the GPU. 2) Kernels are intended to be run on the GPU (or FPGA or some other accelerator device). So code should be restricted to code that can be executed on those devices. Basically kernels should only receive primitives and memory segments. It should only operate on its received args using the 'identity' communicated via the KernelContext. Generally you should not Allocate any Object (or array) , either directly (via new)or by calling methods that will allocate an object or array. So sadly no Strings (* 1 see below) Call any method (static or instance) that is not itself code reflectable via @Reflect annotation. (* 2 see below) Reference any fields (static or instance) not under HAT's control. (* 3 below again) We can map certain Math.xxx() methods. but generally even this may need to be controlled Throw any exceptions or call any method that throws an exception. You can only call static methods which follow the rules above, 3) System.out.println(...) in a kernel fails for multiple reasons (#1, #2 and #3) above :) because it references a static field of System and then tries to call println() on the object that is retrieved from that field and it tries to pass a String which is allocated (the "literal") The first check fails because of the field load on System.out ... hence the (sadly cryptic) "What is this field load"? Regarding ... UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed buildStatus =failed logLen = 186 log = program_source:50:37: error: implicit declaration of function 'squareit' is invalid in OpenCL array->array[(long)HAT_GIX]=squareit(value); Can you send a (small as possible) example that creates this error? If we follow all the rules above (and the ones I have forgotten to include ;) ) you shoduring see this. And The change from @CodeReflection -> @Reflect and requiring lambdas to cast to Compute or Kernel Quotable's is very new. You may have pulled babylon and HAT during a sequence of checkins. Can you try to pull the latest (and rebuild your Babylon enabled JDK) .. and just check that you have the latest version. Regards Gary Confidential- Oracle Internal ________________________________ From: babylon-dev on behalf of nadeesh t v Sent: Saturday, December 13, 2025 5:22 PM To: babylon-dev at openjdk.org Subject: Some minor errors observed in while experimenting with a sample Hello, I was experimenting with a HAT Squares sample () and noticed a couple of minor issues ( at least I think). Since this is still in the development stage, I am not sure whether it?s right to bring it up or not. Let me know if these kinds of minor issues should not be brought up or not. I was using the OpenCL backend. 1 I can mark the argument of kernel function with any one of the RO/RW annotations and still seem to work. For eg: in the original example it was void squareKernel(@RO KernelContext kc, @RW S32Array array) But if I change that to `void squareKernel(@WO KernelContext kc, @RO S32Array array) `, it still works. I would expect it to throw some errors because the access byte has changed. 2 If I add a System.out.println("Hello") in the kernel, it is running to the below issue. ``` @Reflect public static void squareKernel(@WO KernelContext kc, @RO S32Array array) { System.out.println("Hello"); if (kc.gix < kc.gsx){ ?. } } ``` Is there some rule about what should go into the kernel function? ``` what?org.example.MainWithHAT::squareKernel(hat.KernelContext, hat.buffer.S32Array):void java.lang.IllegalStateException: What is this field load ?jdk.incubator.code.dialect.java.JavaOp$FieldAccessOp$FieldLoadOp at 1fc32e4fjava.lang.IllegalStateException: What is this field load ?jdk.incubator.code.dialect.java.JavaOp$FieldAccessOp$FieldLoadOp at 1fc32e4f at hat.codebuilders.C99HATKernelBuilder.fieldLoadOp(C99HATKernelBuilder.java:72) at hat.codebuilders.C99HATKernelBuilder.fieldLoadOp(C99HATKernelBuilder.java:58) ?. ``` 3. If I comment out the Reflect on the function that is called from kernel function ``` // @Reflect public static int squareit(int v) { return v * v; } ``` Then , I am running into the familiar `c` error. ``` UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed buildStatus =failed logLen = 186 log = program_source:50:37: error: implicit declaration of function 'squareit' is invalid in OpenCL array->array[(long)HAT_GIX]=squareit(value); ``` 4. If I comment out the Reflect on the compute method function that is throwing an error from Optional but for that I can create a pull request to throw the one similar to the `did you miss @Reflect annotation?`. -- Thanks and Regards, Nadeesh TV -------------- next part -------------- An HTML attachment was scrubbed... URL: From jfumero at openjdk.org Mon Dec 15 09:47:25 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 15 Dec 2025 09:47:25 GMT Subject: [code-reflection] RFR: HAT memory mallocs and copies improved [v2] In-Reply-To: References: Message-ID: <4r5sFN63SmvMiLQnJ7Xp4dAedDqfDttN32Yqj_ofBf4=.81d9fdc8-80fe-4c4b-88bd-b3ffd97e619b@github.com> On Fri, 12 Dec 2025 17:31:32 GMT, Gary Frost wrote: >> Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: >> >> [hat] life-example revert control to RO > > hat/backends/ffi/cuda/src/main/native/cpp/cuda_backend.cpp line 366: > >> 364: CudaBackend::CudaBuffer *CudaBackend::getOrCreateBuffer(BufferState *bufferState, u8_t accessor) { >> 365: CudaBuffer *cudaBuffer = nullptr; >> 366: if (bufferState->vendorPtr == nullptr || bufferState->state == BufferState::NEW_STATE) { > > So I understand we are embedding the access (RO|WO etc) in the buffer... > > we get this access from the arg slot info (RO|WO etc) and then putting this in the memory segment.. > > What if we pass this to another kernel whose access is different? Accesses declared from the API side are immutable. In the case it changes it should be declared as R/W. The copy on-demand will work because it takes the access for the arg slot. We can revisit this model. Note that, if a buffer is Read-only, later we can't change it, unless we do a new malloc and move the data to the new buffer. But this is very inefficient. So, if this is what we want, we need to find other options. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/746#discussion_r2618694305 From gfrost at openjdk.org Mon Dec 15 10:24:50 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 15 Dec 2025 10:24:50 GMT Subject: git: openjdk/babylon: code-reflection: Config parsing was not capturing PLATFORM:n or DEVICE:n Message-ID: <4db0ee8b-448c-41ab-bfd2-c0a4a27fb5a8@openjdk.org> Changeset: 8465bab5 Branch: code-reflection Author: Gary Frost Date: 2025-12-15 10:22:49 +0000 URL: https://git.openjdk.org/babylon/commit/8465bab5ed2bc2cbe7a8fd6d8d07b9107babb5c8 Config parsing was not capturing PLATFORM:n or DEVICE:n ! hat/core/src/main/java/hat/Config.java ! hat/intellij/.idea/misc.xml From gfrost at openjdk.org Mon Dec 15 10:25:51 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 15 Dec 2025 10:25:51 GMT Subject: [code-reflection] Integrated: Config parsing was not capturing PLATFORM:n or DEVICE:n Message-ID: Fixed Config parser which was failing to parse PLATFORN:n and DEVICE:n Tidied up parser and deleted dead code. ------------- Commit messages: - Config parsing was not capturing PLATFORM:n or DEVICE:n Changes: https://git.openjdk.org/babylon/pull/749/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=749&range=00 Stats: 73 lines in 2 files changed: 16 ins; 39 del; 18 mod Patch: https://git.openjdk.org/babylon/pull/749.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/749/head:pull/749 PR: https://git.openjdk.org/babylon/pull/749 From gfrost at openjdk.org Mon Dec 15 10:25:52 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 15 Dec 2025 10:25:52 GMT Subject: [code-reflection] Integrated: Config parsing was not capturing PLATFORM:n or DEVICE:n In-Reply-To: References: Message-ID: On Mon, 15 Dec 2025 10:18:57 GMT, Gary Frost wrote: > Fixed Config parser which was failing to parse PLATFORN:n and DEVICE:n > > Tidied up parser and deleted dead code. This pull request has now been integrated. Changeset: 8465bab5 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/8465bab5ed2bc2cbe7a8fd6d8d07b9107babb5c8 Stats: 73 lines in 2 files changed: 16 ins; 39 del; 18 mod Config parsing was not capturing PLATFORM:n or DEVICE:n ------------- PR: https://git.openjdk.org/babylon/pull/749 From asotona at openjdk.org Mon Dec 15 10:28:12 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 15 Dec 2025 10:28:12 GMT Subject: [code-reflection] Integrated: 8373576: BytecodeGenerator fails with AssertionError on InvokeOp with varargs In-Reply-To: References: Message-ID: On Fri, 12 Dec 2025 14:01:27 GMT, Adam Sotona wrote: > The first operand of a static vararg method invocation is wrongly identified as the first operand on stack for the following bytecode instruction. > However several bytecode instructions prepend the operand use, so the operand presence on the stack must be deferred. This pull request has now been integrated. Changeset: 476bbf7b Author: Adam Sotona URL: https://git.openjdk.org/babylon/commit/476bbf7b3649002487ecf9ce63734a2fb70bf312 Stats: 8 lines in 2 files changed: 8 ins; 0 del; 0 mod 8373576: BytecodeGenerator fails with AssertionError on InvokeOp with varargs ------------- PR: https://git.openjdk.org/babylon/pull/747 From asotona at openjdk.org Mon Dec 15 10:30:18 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 15 Dec 2025 10:30:18 GMT Subject: git: openjdk/babylon: code-reflection: 8373576: BytecodeGenerator fails with AssertionError on InvokeOp with varargs Message-ID: <5c52d400-e14d-4544-b40f-4da1cec2564b@openjdk.org> Changeset: 476bbf7b Branch: code-reflection Author: Adam Sotona Date: 2025-12-15 10:25:31 +0000 URL: https://git.openjdk.org/babylon/commit/476bbf7b3649002487ecf9ce63734a2fb70bf312 8373576: BytecodeGenerator fails with AssertionError on InvokeOp with varargs ! src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/BytecodeGenerator.java ! test/jdk/java/lang/reflect/code/bytecode/TestBytecode.java From mcimadamore at openjdk.org Mon Dec 15 11:38:42 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 15 Dec 2025 11:38:42 GMT Subject: [code-reflection] RFR: 8373571: Code model of JavaOp.ForOp does not handle (un)boxing correctly Message-ID: This PR addresses an issue in for-each loop model generation. The for each op factory takes three bodies: 1. the for each expression (e.g. either a collection, or an array) 2. the for each initializer (the logic that receives an element from the expression, and turns it into the expected variable type in the source code) 3. the for each body The translation for (2) seems to contain a bug: javac erroneously assumes that the initializer body has type `(V)->V`, where `V` is the type of the induction variable declared in the source code. This PR fixes that so that (2) has type `(ELEM)->V`, where `ELEM` is the static type of an element of the for-each expression, and `V` is the static type of the induction variable. This translation allows uboxing operations to appear manifest in the generated model. ------------- Commit messages: - Add tests - Initial push Changes: https://git.openjdk.org/babylon/pull/750/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=750&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8373571 Stats: 79 lines in 2 files changed: 76 ins; 1 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/750.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/750/head:pull/750 PR: https://git.openjdk.org/babylon/pull/750 From mcimadamore at openjdk.org Mon Dec 15 11:53:42 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 15 Dec 2025 11:53:42 GMT Subject: [code-reflection] RFR: 8373571: Code model of JavaOp.ForOp does not handle (un)boxing correctly [v2] In-Reply-To: References: Message-ID: > This PR addresses an issue in for-each loop model generation. > The for each op factory takes three bodies: > 1. the for each expression (e.g. either a collection, or an array) > 2. the for each initializer (the logic that receives an element from the expression, and turns it into the expected variable type in the source code) > 3. the for each body > > The translation for (2) seems to contain a bug: javac erroneously assumes that the initializer body has type `(V)->V`, where `V` is the type of the induction variable declared in the source code. > > This PR fixes that so that (2) has type `(ELEM)->V`, where `ELEM` is the static type of an element of the for-each expression, and `V` is the static type of the induction variable. > > This translation allows uboxing operations to appear manifest in the generated model. Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: Make sure logic for determining expression element type is same as in `Attr` Add more tests ------------- Changes: - all: https://git.openjdk.org/babylon/pull/750/files - new: https://git.openjdk.org/babylon/pull/750/files/c08ee937..7e220e1b Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=750&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=750&range=00-01 Stats: 82 lines in 2 files changed: 79 ins; 0 del; 3 mod Patch: https://git.openjdk.org/babylon/pull/750.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/750/head:pull/750 PR: https://git.openjdk.org/babylon/pull/750 From mcimadamore at openjdk.org Mon Dec 15 11:53:44 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Mon, 15 Dec 2025 11:53:44 GMT Subject: [code-reflection] RFR: 8373571: Code model of JavaOp.ForOp does not handle (un)boxing correctly [v2] In-Reply-To: References: Message-ID: On Mon, 15 Dec 2025 11:50:20 GMT, Maurizio Cimadamore wrote: >> This PR addresses an issue in for-each loop model generation. >> The for each op factory takes three bodies: >> 1. the for each expression (e.g. either a collection, or an array) >> 2. the for each initializer (the logic that receives an element from the expression, and turns it into the expected variable type in the source code) >> 3. the for each body >> >> The translation for (2) seems to contain a bug: javac erroneously assumes that the initializer body has type `(V)->V`, where `V` is the type of the induction variable declared in the source code. >> >> This PR fixes that so that (2) has type `(ELEM)->V`, where `ELEM` is the static type of an element of the for-each expression, and `V` is the static type of the induction variable. >> >> This translation allows uboxing operations to appear manifest in the generated model. > > Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: > > Make sure logic for determining expression element type is same as in `Attr` > Add more tests src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java line 1874: > 1872: // return the bound variables > 1873: Type exprType = types.cvarUpperBound(tree.expr.type); > 1874: Type elemtype = types.elemtype(exprType); // perhaps expr is an array? The logic here is very similar with what `Attr` does -- as we really want to use the same expression element type ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/750#discussion_r2619091016 From jfumero at openjdk.org Mon Dec 15 17:00:09 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 15 Dec 2025 17:00:09 GMT Subject: [code-reflection] RFR: [hat] Remove device custom data types that inherit from Buffer Message-ID: This PR removes the codegen that implemented the logic for processing custom data types for device types that inherit from the iFace buffer. >From now on, iFace buffers represent data represent to be allocated and pass to device's global memory. These buffers backup memory segment on the CPU. For device types, we can build custom data types as well but they inherit from `DeviceType`. For example, local memory, and private memory. How to test: java @hat/test-suite ffi-opencl java @hat/test-suite ffi-cuda ------------- Commit messages: - minor chanage - formatter - [hat] obtain varOp name for the CUDA Vector BinOps - [hat] DeviceType via iFace buffers removed Changes: https://git.openjdk.org/babylon/pull/751/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=751&range=00 Stats: 118 lines in 4 files changed: 30 ins; 57 del; 31 mod Patch: https://git.openjdk.org/babylon/pull/751.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/751/head:pull/751 PR: https://git.openjdk.org/babylon/pull/751 From jfumero at openjdk.org Mon Dec 15 17:32:17 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 15 Dec 2025 17:32:17 GMT Subject: [code-reflection] Integrated: [hat] Remove device custom data types that inherit from Buffer In-Reply-To: References: Message-ID: On Mon, 15 Dec 2025 14:56:48 GMT, Juan Fumero wrote: > This PR removes the codegen that implemented the logic for processing custom data types for device types that inherit from the iFace buffer. > > From now on, iFace buffers represent data represent to be allocated and pass to device's global memory. > These buffers backup memory segment on the CPU. > > For device types, we can build custom data types as well but they inherit from `DeviceType`. For example, local memory, and private memory. > > How to test: > > > java @hat/test-suite ffi-opencl > > java @hat/test-suite ffi-cuda This pull request has now been integrated. Changeset: 4d5e9a0c Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/4d5e9a0c8d3c69a779674e9f36f7f4d9aba6627d Stats: 118 lines in 4 files changed: 30 ins; 57 del; 31 mod [hat] Remove device custom data types that inherit from Buffer ------------- PR: https://git.openjdk.org/babylon/pull/751 From jfumero at openjdk.org Mon Dec 15 17:33:09 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Mon, 15 Dec 2025 17:33:09 GMT Subject: git: openjdk/babylon: code-reflection: [hat] Remove device custom data types that inherit from Buffer Message-ID: <092790c2-431f-417a-89b2-c80659aa39d4@openjdk.org> Changeset: 4d5e9a0c Branch: code-reflection Author: Juan Fumero Date: 2025-12-15 17:29:19 +0000 URL: https://git.openjdk.org/babylon/commit/4d5e9a0c8d3c69a779674e9f36f7f4d9aba6627d [hat] Remove device custom data types that inherit from Buffer ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java ! hat/tests/src/main/java/hat/test/TestArrayView.java ! hat/tests/src/main/java/hat/test/TestVectorArrayView.java From asotona at openjdk.org Mon Dec 15 17:47:46 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 15 Dec 2025 17:47:46 GMT Subject: [code-reflection] RFR: 8373572: BytecodeGenerator throws UnsupportedOperationException for JavaOp.InvokeOp when invoke kind is SUPER. Message-ID: We cannot generate an invokespecial as it will result in a verify error, since the owner is not assignable to generated hidden class. This patch constructs method handle via lookup.findSpecial using the lookup's class as the specialCaller. Original lookup is stored in class data of the constructed hidden class. ------------- Commit messages: - 8373572: BytecodeGenerator throws UnsupportedOperationException for JavaOp.InvokeOp when invoke kind is SUPER. Changes: https://git.openjdk.org/babylon/pull/752/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=752&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8373572 Stats: 57 lines in 2 files changed: 29 ins; 19 del; 9 mod Patch: https://git.openjdk.org/babylon/pull/752.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/752/head:pull/752 PR: https://git.openjdk.org/babylon/pull/752 From asotona at openjdk.org Mon Dec 15 17:47:47 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 15 Dec 2025 17:47:47 GMT Subject: [code-reflection] RFR: 8373572: BytecodeGenerator throws UnsupportedOperationException for JavaOp.InvokeOp when invoke kind is SUPER. In-Reply-To: References: Message-ID: On Mon, 15 Dec 2025 17:39:47 GMT, Adam Sotona wrote: > We cannot generate an invokespecial as it will result in a verify error, since the owner is not assignable to generated hidden class. > > This patch constructs method handle via lookup.findSpecial using the lookup's class as the specialCaller. > Original lookup is stored in class data of the constructed hidden class. src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/BytecodeGenerator.java line 814: > 812: .invokevirtual(CD_MethodHandles_Lookup, > 813: "findSpecial", > 814: MethodTypeDesc.of(CD_MethodHandle, CD_Class, CD_String, CD_MethodType, CD_Class)); Performance can be improved (if necessary) by indexing of all resolved method handles and storing them in class data as a list. Invoke code would not perform search for the method handle, but it will receive it directly from class data. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/752#discussion_r2620295479 From asotona at openjdk.org Mon Dec 15 17:58:57 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 15 Dec 2025 17:58:57 GMT Subject: [code-reflection] RFR: 8373571: Code model of JavaOp.ForOp does not handle (un)boxing correctly [v2] In-Reply-To: References: Message-ID: On Mon, 15 Dec 2025 11:53:42 GMT, Maurizio Cimadamore wrote: >> This PR addresses an issue in for-each loop model generation. >> The for each op factory takes three bodies: >> 1. the for each expression (e.g. either a collection, or an array) >> 2. the for each initializer (the logic that receives an element from the expression, and turns it into the expected variable type in the source code) >> 3. the for each body >> >> The translation for (2) seems to contain a bug: javac erroneously assumes that the initializer body has type `(V)->V`, where `V` is the type of the induction variable declared in the source code. >> >> This PR fixes that so that (2) has type `(ELEM)->V`, where `ELEM` is the static type of an element of the for-each expression, and `V` is the static type of the induction variable. >> >> This translation allows uboxing operations to appear manifest in the generated model. > > Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: > > Make sure logic for determining expression element type is same as in `Attr` > Add more tests It looks good to me. ------------- Marked as reviewed by asotona (Reviewer). PR Review: https://git.openjdk.org/babylon/pull/750#pullrequestreview-3579481918 From nadeeshtv at gmail.com Mon Dec 15 22:23:30 2025 From: nadeeshtv at gmail.com (nadeesh t v) Date: Mon, 15 Dec 2025 23:23:30 +0100 Subject: Some minor errors observed in while experimenting with a sample In-Reply-To: References: Message-ID: Hi Gary, >Can you send a (small as possible) example that creates this error? I have attached the sample ( not sure , mail server will be stripped away) but it is similar to the Squares sample . For error 3 (Implicit declaration of function 'squareit' is invalid in OpenCL ), I am wondering whether we can check that all functions that are reachable from the kernel function is annotated with @Reflect using the KernelGraph, and if not fail early with a Java exception rather than the current error. > You may have pulled Babylon and HAT during a sequence of checkins. Yes, mine is 2-3 weeks old. >.>If we follow all the rules above (and the ones I have forgotten to include ;) ) you shoduring see this. Sorry, this part, I have not understood completely. Even if I use the latest Babylon JDK, all errors should stay the same right? Best regards, Nadeesh -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MainWithHAT.java Type: application/octet-stream Size: 1995 bytes Desc: not available URL: From psandoz at openjdk.org Mon Dec 15 22:29:46 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Mon, 15 Dec 2025 22:29:46 GMT Subject: [code-reflection] RFR: 8373572: BytecodeGenerator throws UnsupportedOperationException for JavaOp.InvokeOp when invoke kind is SUPER. In-Reply-To: References: Message-ID: On Mon, 15 Dec 2025 17:39:47 GMT, Adam Sotona wrote: > We cannot generate an invokespecial as it will result in a verify error, since the owner is not assignable to generated hidden class. > > This patch constructs method handle via lookup.findSpecial using the lookup's class as the specialCaller. > Original lookup is stored in class data of the constructed hidden class. src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/BytecodeGenerator.java line 860: > 858: case SUPER -> > 859: cob.invokevirtual(CD_MethodHandle, > 860: "invoke", Can you use `invokeExact`? ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/752#discussion_r2621068488 From psandoz at openjdk.org Tue Dec 16 00:27:19 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Tue, 16 Dec 2025 00:27:19 GMT Subject: [code-reflection] RFR: 8373571: Code model of JavaOp.ForOp does not handle (un)boxing correctly [v2] In-Reply-To: References: Message-ID: <9U7mZPyNpDA8fccTVitk2fJVJ9LJN9RxfEKb-GhjoUI=.8f72e086-77a5-433d-98cc-7d44bf83718d@github.com> On Mon, 15 Dec 2025 11:53:42 GMT, Maurizio Cimadamore wrote: >> This PR addresses an issue in for-each loop model generation. >> The for each op factory takes three bodies: >> 1. the for each expression (e.g. either a collection, or an array) >> 2. the for each initializer (the logic that receives an element from the expression, and turns it into the expected variable type in the source code) >> 3. the for each body >> >> The translation for (2) seems to contain a bug: javac erroneously assumes that the initializer body has type `(V)->V`, where `V` is the type of the induction variable declared in the source code. >> >> This PR fixes that so that (2) has type `(ELEM)->V`, where `ELEM` is the static type of an element of the for-each expression, and `V` is the static type of the induction variable. >> >> This translation allows uboxing operations to appear manifest in the generated model. > > Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: > > Make sure logic for determining expression element type is same as in `Attr` > Add more tests Looks good. This should also allow for conversions. When building the enhanced for op it us up to code building to ensure the types line up. At first i was questioning whether we should keep the enhanced for op or remove and model as a de-sugared for op, and provide a way to detect as if it were modeled from an enhanced for. But when patterns in the initializer come back the enhanced for op modelling (which anticipated use of patterns) will be clearer than that of the desugared for loop. ------------- Marked as reviewed by psandoz (Lead). PR Review: https://git.openjdk.org/babylon/pull/750#pullrequestreview-3580670512 From asotona at openjdk.org Tue Dec 16 08:40:29 2025 From: asotona at openjdk.org (Adam Sotona) Date: Tue, 16 Dec 2025 08:40:29 GMT Subject: [code-reflection] RFR: 8373572: BytecodeGenerator throws UnsupportedOperationException for JavaOp.InvokeOp when invoke kind is SUPER. [v2] In-Reply-To: References: Message-ID: > We cannot generate an invokespecial as it will result in a verify error, since the owner is not assignable to generated hidden class. > > This patch constructs method handle via lookup.findSpecial using the lookup's class as the specialCaller. > Original lookup is stored in class data of the constructed hidden class. Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: MH::invokeExact ------------- Changes: - all: https://git.openjdk.org/babylon/pull/752/files - new: https://git.openjdk.org/babylon/pull/752/files/ba0d11f8..8b044a6a Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=752&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=752&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/752.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/752/head:pull/752 PR: https://git.openjdk.org/babylon/pull/752 From mcimadamore at openjdk.org Tue Dec 16 10:00:07 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Tue, 16 Dec 2025 10:00:07 GMT Subject: git: openjdk/babylon: code-reflection: 8373571: Code model of JavaOp.ForOp does not handle (un)boxing correctly Message-ID: <58d7b872-6a84-48f4-82ba-e1811e2fa51c@openjdk.org> Changeset: c3455b1d Branch: code-reflection Author: Maurizio Cimadamore Date: 2025-12-16 09:58:16 +0000 URL: https://git.openjdk.org/babylon/commit/c3455b1d11f9d2b50739f702b42cf4c620569dc7 8373571: Code model of JavaOp.ForOp does not handle (un)boxing correctly Reviewed-by: asotona, psandoz ! src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java ! test/langtools/tools/javac/reflect/BoxingConversionTest.java ! test/langtools/tools/javac/reflect/ImplicitConversionTest.java From mcimadamore at openjdk.org Tue Dec 16 10:02:41 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Tue, 16 Dec 2025 10:02:41 GMT Subject: [code-reflection] RFR: 8373571: Code model of JavaOp.ForOp does not handle (un)boxing correctly [v3] In-Reply-To: References: Message-ID: > This PR addresses an issue in for-each loop model generation. > The for each op factory takes three bodies: > 1. the for each expression (e.g. either a collection, or an array) > 2. the for each initializer (the logic that receives an element from the expression, and turns it into the expected variable type in the source code) > 3. the for each body > > The translation for (2) seems to contain a bug: javac erroneously assumes that the initializer body has type `(V)->V`, where `V` is the type of the induction variable declared in the source code. > > This PR fixes that so that (2) has type `(ELEM)->V`, where `ELEM` is the static type of an element of the for-each expression, and `V` is the static type of the induction variable. > > This translation allows uboxing operations to appear manifest in the generated model. Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: Add test on implicit primitive widening in for each ------------- Changes: - all: https://git.openjdk.org/babylon/pull/750/files - new: https://git.openjdk.org/babylon/pull/750/files/7e220e1b..e19a0930 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=750&range=02 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=750&range=01-02 Stats: 35 lines in 1 file changed: 35 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/750.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/750/head:pull/750 PR: https://git.openjdk.org/babylon/pull/750 From mcimadamore at openjdk.org Tue Dec 16 10:02:42 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Tue, 16 Dec 2025 10:02:42 GMT Subject: [code-reflection] Integrated: 8373571: Code model of JavaOp.ForOp does not handle (un)boxing correctly In-Reply-To: References: Message-ID: On Mon, 15 Dec 2025 11:31:45 GMT, Maurizio Cimadamore wrote: > This PR addresses an issue in for-each loop model generation. > The for each op factory takes three bodies: > 1. the for each expression (e.g. either a collection, or an array) > 2. the for each initializer (the logic that receives an element from the expression, and turns it into the expected variable type in the source code) > 3. the for each body > > The translation for (2) seems to contain a bug: javac erroneously assumes that the initializer body has type `(V)->V`, where `V` is the type of the induction variable declared in the source code. > > This PR fixes that so that (2) has type `(ELEM)->V`, where `ELEM` is the static type of an element of the for-each expression, and `V` is the static type of the induction variable. > > This translation allows uboxing operations to appear manifest in the generated model. This pull request has now been integrated. Changeset: c3455b1d Author: Maurizio Cimadamore URL: https://git.openjdk.org/babylon/commit/c3455b1d11f9d2b50739f702b42cf4c620569dc7 Stats: 193 lines in 3 files changed: 190 ins; 1 del; 2 mod 8373571: Code model of JavaOp.ForOp does not handle (un)boxing correctly Reviewed-by: asotona, psandoz ------------- PR: https://git.openjdk.org/babylon/pull/750 From asotona at openjdk.org Tue Dec 16 15:47:33 2025 From: asotona at openjdk.org (Adam Sotona) Date: Tue, 16 Dec 2025 15:47:33 GMT Subject: [code-reflection] Integrated: 8373572: BytecodeGenerator throws UnsupportedOperationException for JavaOp.InvokeOp when invoke kind is SUPER. In-Reply-To: References: Message-ID: On Mon, 15 Dec 2025 17:39:47 GMT, Adam Sotona wrote: > We cannot generate an invokespecial as it will result in a verify error, since the owner is not assignable to generated hidden class. > > This patch constructs method handle via lookup.findSpecial using the lookup's class as the specialCaller. > Original lookup is stored in class data of the constructed hidden class. This pull request has now been integrated. Changeset: f70f53ac Author: Adam Sotona URL: https://git.openjdk.org/babylon/commit/f70f53ac2b56c7f1e0968e4a3115b92e9447f1c9 Stats: 57 lines in 2 files changed: 29 ins; 19 del; 9 mod 8373572: BytecodeGenerator throws UnsupportedOperationException for JavaOp.InvokeOp when invoke kind is SUPER. ------------- PR: https://git.openjdk.org/babylon/pull/752 From asotona at openjdk.org Tue Dec 16 15:51:45 2025 From: asotona at openjdk.org (Adam Sotona) Date: Tue, 16 Dec 2025 15:51:45 GMT Subject: git: openjdk/babylon: code-reflection: 8373572: BytecodeGenerator throws UnsupportedOperationException for JavaOp.InvokeOp when invoke kind is SUPER. Message-ID: <960beec5-4d36-4b51-925b-3dfb30c142dd@openjdk.org> Changeset: f70f53ac Branch: code-reflection Author: Adam Sotona Date: 2025-12-16 15:45:12 +0000 URL: https://git.openjdk.org/babylon/commit/f70f53ac2b56c7f1e0968e4a3115b92e9447f1c9 8373572: BytecodeGenerator throws UnsupportedOperationException for JavaOp.InvokeOp when invoke kind is SUPER. ! src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/BytecodeGenerator.java ! test/jdk/java/lang/reflect/code/bytecode/TestInvokeSuper.java From gfrost at openjdk.org Tue Dec 16 16:13:35 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 16 Dec 2025 16:13:35 GMT Subject: git: openjdk/babylon: code-reflection: Streamlining OpTk and preparing to move out of HAT core Message-ID: Changeset: be81a41a Branch: code-reflection Author: Gary Frost Date: 2025-12-16 16:11:20 +0000 URL: https://git.openjdk.org/babylon/commit/be81a41a71d6453aadea76a70f8052aaf560c231 Streamlining OpTk and preparing to move out of HAT core ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/optools/OpTk.java + hat/core/src/main/java/hat/optools/Trxfmr.java ! hat/core/src/main/java/hat/phases/HATDialect.java ! hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyBarrierPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyFP16Phase.java ! hat/core/src/main/java/hat/phases/HATDialectifyMemoryPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyThreadsPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorOpPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorSelectPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorStorePhase.java ! hat/tools/src/main/java/hat/tools/text/JavaHATCodeBuilder.java From gfrost at openjdk.org Tue Dec 16 16:14:38 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 16 Dec 2025 16:14:38 GMT Subject: [code-reflection] Integrated: Streamlining OpTk and preparing to move out of HAT core Message-ID: <9Pu0qs-a9xhoiPxhqiL0qaXCA_WIvJBaMITQjc_V5KI=.79fa257c-7bcd-4cef-8d26-91bf36c32400@github.com> I have been moving common code into OpTk Also added a strawman Txfmr class for simplifying common transformations I plan to move OpTk (well the parts not requireing HAT) up to its own lib This code leaves code artifacts (HAT_GIX) in generated C99. I need to track thoose down. They seem to compile ok and run.. ------------- Commit messages: - Streamlining OpTk and preparing to move out of HAT core Changes: https://git.openjdk.org/babylon/pull/753/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=753&range=00 Stats: 998 lines in 17 files changed: 586 ins; 197 del; 215 mod Patch: https://git.openjdk.org/babylon/pull/753.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/753/head:pull/753 PR: https://git.openjdk.org/babylon/pull/753 From gfrost at openjdk.org Tue Dec 16 16:14:39 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 16 Dec 2025 16:14:39 GMT Subject: [code-reflection] Integrated: Streamlining OpTk and preparing to move out of HAT core In-Reply-To: <9Pu0qs-a9xhoiPxhqiL0qaXCA_WIvJBaMITQjc_V5KI=.79fa257c-7bcd-4cef-8d26-91bf36c32400@github.com> References: <9Pu0qs-a9xhoiPxhqiL0qaXCA_WIvJBaMITQjc_V5KI=.79fa257c-7bcd-4cef-8d26-91bf36c32400@github.com> Message-ID: On Tue, 16 Dec 2025 16:08:26 GMT, Gary Frost wrote: > I have been moving common code into OpTk > > Also added a strawman Txfmr class for simplifying common transformations > > I plan to move OpTk (well the parts not requireing HAT) up to its own lib > > This code leaves code artifacts (HAT_GIX) in generated C99. I need to track thoose down. They seem to compile ok and run.. This pull request has now been integrated. Changeset: be81a41a Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/be81a41a71d6453aadea76a70f8052aaf560c231 Stats: 998 lines in 17 files changed: 586 ins; 197 del; 215 mod Streamlining OpTk and preparing to move out of HAT core ------------- PR: https://git.openjdk.org/babylon/pull/753 From nadeeshtv at gmail.com Tue Dec 16 23:12:21 2025 From: nadeeshtv at gmail.com (nadeesh t v) Date: Wed, 17 Dec 2025 00:12:21 +0100 Subject: Some minor errors observed in while experimenting with a sample In-Reply-To: References: Message-ID: Hi Gary, I tried with the latest build and I can reproduce reported issue *3* with the TestArrays ``` *diff --git a/hat/tests/src/main/java/hat/test/TestArrays.java b/hat/tests/src/main/java/hat/test/TestArrays.java* *index b5aed9f85da..3dccbaabf8c 100644* *--- a/hat/tests/src/main/java/hat/test/TestArrays.java* *+++ b/hat/tests/src/main/java/hat/test/TestArrays.java* @@ -42,7 +42,7 @@ public class TestArrays { - @Reflect + //@Reflect public static int squareit(int v) { return v * v; ``` With the following command `java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestArrays` ``` HAT Engine Testing Framework Testing Backend: hat.backend.ffi.OpenCLBackend UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed buildStatus =failed logLen = 186 log = program_source:70:37: error: implicit declaration of function 'squareit' is invalid in OpenCL array->array[(long)HAT_GIX]=squareit(value); ^ what?hat.test.TestArrays::squareKernel(hat.KernelContext, hat.buffer.S32Array):void java.lang.IllegalStateException: OpenCL program failed to compilejava.lang.IllegalStateException: OpenCL program failed to compile at hat.backend.ffi.OpenCLBackend.lambda$dispatchKernel$0(OpenCLBackend.java:58) at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1229) at hat.backend.ffi.OpenCLBackend.dispatchKernel(OpenCLBackend.java:47) at hat.ComputeContext.dispatchKernelWithComputeRange(ComputeContext.java:133) at hat.ComputeContext.dispatchKernel(ComputeContext.java:111) ``` Regards, Nadeesh -------------- next part -------------- An HTML attachment was scrubbed... URL: From jfumero at openjdk.org Wed Dec 17 09:08:19 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 17 Dec 2025 09:08:19 GMT Subject: [code-reflection] RFR: [hat] CUDA Backend Codegen fixed Message-ID: CUDA Backend Codegen fixed ------------- Commit messages: - [hat] CUDA Backend Codegen fixed Changes: https://git.openjdk.org/babylon/pull/754/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=754&range=00 Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/754.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/754/head:pull/754 PR: https://git.openjdk.org/babylon/pull/754 From mabbay at openjdk.org Wed Dec 17 10:27:13 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 17 Dec 2025 10:27:13 GMT Subject: [code-reflection] Withdrawn: Local class model In-Reply-To: References: Message-ID: <26P0-GqpldDVjctES3ecu4UsA4XPynT1jvOThSXbnaw=.d586696b-44c6-4f64-af1f-e5b68ff1deca@github.com> On Fri, 21 Nov 2025 04:44:16 GMT, Mourad Abbay wrote: > An attempt to model local classes. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/babylon/pull/692 From mabbay at openjdk.org Wed Dec 17 10:28:10 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 17 Dec 2025 10:28:10 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v2] In-Reply-To: References: Message-ID: > Write test to make sure java version check we do before building models is working. > There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Run the tests in two steps ------------- Changes: - all: https://git.openjdk.org/babylon/pull/748/files - new: https://git.openjdk.org/babylon/pull/748/files/6ce91b04..c4249a63 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=748&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=748&range=00-01 Stats: 62 lines in 2 files changed: 15 ins; 41 del; 6 mod Patch: https://git.openjdk.org/babylon/pull/748.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/748/head:pull/748 PR: https://git.openjdk.org/babylon/pull/748 From jfumero at openjdk.org Wed Dec 17 12:15:00 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 17 Dec 2025 12:15:00 GMT Subject: git: openjdk/babylon: code-reflection: [hat] CUDA Backend Codegen fixed Message-ID: Changeset: d4f16ac9 Branch: code-reflection Author: Juan Fumero Date: 2025-12-17 12:12:44 +0000 URL: https://git.openjdk.org/babylon/commit/d4f16ac9b1898df9b1b12044b6c52a14de2ce265 [hat] CUDA Backend Codegen fixed ! hat/core/src/main/java/hat/optools/OpTk.java From jfumero at openjdk.org Wed Dec 17 12:15:21 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 17 Dec 2025 12:15:21 GMT Subject: [code-reflection] Integrated: [hat] CUDA Backend Codegen fixed In-Reply-To: References: Message-ID: On Wed, 17 Dec 2025 09:03:28 GMT, Juan Fumero wrote: > CUDA Backend Codegen fixed This pull request has now been integrated. Changeset: d4f16ac9 Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/d4f16ac9b1898df9b1b12044b6c52a14de2ce265 Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod [hat] CUDA Backend Codegen fixed ------------- PR: https://git.openjdk.org/babylon/pull/754 From mcimadamore at openjdk.org Wed Dec 17 12:41:23 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Wed, 17 Dec 2025 12:41:23 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v2] In-Reply-To: References: Message-ID: <-HQxKk_dFOoOjgP80mbJOxOqIrIYaM9Xo-N4nt-zEDE=.25857776-3c7b-4df0-8e94-36a92b5a2a39@github.com> On Wed, 17 Dec 2025 10:28:10 GMT, Mourad Abbay wrote: >> Write test to make sure java version check we do before building models is working. >> There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Run the tests in two steps test/jdk/java/lang/reflect/code/writer/TestJavaVersionChecker.java line 27: > 25: String testClassName = TestJavaVersionChecker.class.getName(); > 26: Path testClassesDir = Path.of(System.getProperty("test.classes")); > 27: Path innerClassPath = FileSystems.getDefault().getPath(testClassesDir.toString(), testClassName + "$$CM.class"); I think this can be: Path innerClassPath = testClassesDir.resolve(testClassName + "$$CM.class"); ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/748#discussion_r2626902807 From mcimadamore at openjdk.org Wed Dec 17 12:45:54 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Wed, 17 Dec 2025 12:45:54 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v2] In-Reply-To: References: Message-ID: On Wed, 17 Dec 2025 10:28:10 GMT, Mourad Abbay wrote: >> Write test to make sure java version check we do before building models is working. >> There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Run the tests in two steps Marked as reviewed by mcimadamore (Reviewer). ------------- PR Review: https://git.openjdk.org/babylon/pull/748#pullrequestreview-3587554928 From gfrost at openjdk.org Wed Dec 17 13:14:39 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 17 Dec 2025 13:14:39 GMT Subject: git: openjdk/babylon: code-reflection: Added HatVarOp marker interface and OpTk helpers Message-ID: <7000a04f-26f1-4469-aa23-46d8b945e98a@openjdk.org> Changeset: 74dc49d7 Branch: code-reflection Author: Gary Frost Date: 2025-12-17 13:13:18 +0000 URL: https://git.openjdk.org/babylon/commit/74dc49d70afb3374a7754443e09dbe7ab7bf083f Added HatVarOp marker interface and OpTk helpers ! hat/core/src/main/java/hat/dialect/HATF16Op.java ! hat/core/src/main/java/hat/dialect/HATMemoryOp.java = hat/core/src/main/java/hat/dialect/HATVarOp.java ! hat/core/src/main/java/hat/dialect/HATVectorOp.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/phases/HATDialectifyThreadsPhase.java From gfrost at openjdk.org Wed Dec 17 13:17:18 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 17 Dec 2025 13:17:18 GMT Subject: [code-reflection] Integrated: Added HatVarOp marker interface and OpTk helpers Message-ID: <0LUGizoGPEswtxrtDENJW4D6MA89XJbNdWAvjCnUzfU=.2f7b06db-d305-4ee8-9ec3-1d32db4589ef@github.com> Added HATVarOp marker interface to group HATOp's yielding a varName; Also added some OpTk helpers to simplyfy selecting op's for transformations. ------------- Commit messages: - Added HatVarOp marker interface and OpTk helpers Changes: https://git.openjdk.org/babylon/pull/755/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=755&range=00 Stats: 95 lines in 6 files changed: 37 ins; 13 del; 45 mod Patch: https://git.openjdk.org/babylon/pull/755.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/755/head:pull/755 PR: https://git.openjdk.org/babylon/pull/755 From gfrost at openjdk.org Wed Dec 17 13:17:19 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 17 Dec 2025 13:17:19 GMT Subject: [code-reflection] Integrated: Added HatVarOp marker interface and OpTk helpers In-Reply-To: <0LUGizoGPEswtxrtDENJW4D6MA89XJbNdWAvjCnUzfU=.2f7b06db-d305-4ee8-9ec3-1d32db4589ef@github.com> References: <0LUGizoGPEswtxrtDENJW4D6MA89XJbNdWAvjCnUzfU=.2f7b06db-d305-4ee8-9ec3-1d32db4589ef@github.com> Message-ID: On Wed, 17 Dec 2025 13:09:22 GMT, Gary Frost wrote: > Added HATVarOp marker interface to group HATOp's yielding a varName; > > Also added some OpTk helpers to simplyfy selecting op's for transformations. This pull request has now been integrated. Changeset: 74dc49d7 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/74dc49d70afb3374a7754443e09dbe7ab7bf083f Stats: 95 lines in 6 files changed: 37 ins; 13 del; 45 mod Added HatVarOp marker interface and OpTk helpers ------------- PR: https://git.openjdk.org/babylon/pull/755 From gfrost at openjdk.org Wed Dec 17 13:56:34 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 17 Dec 2025 13:56:34 GMT Subject: [code-reflection] Integrated: Fix regression in last PR Message-ID: Turns out a VarOp instanceof check does not work here. For NVidia ------------- Commit messages: - Fix regression in last PR Changes: https://git.openjdk.org/babylon/pull/756/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=756&range=00 Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/756.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/756/head:pull/756 PR: https://git.openjdk.org/babylon/pull/756 From gfrost at openjdk.org Wed Dec 17 13:56:34 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 17 Dec 2025 13:56:34 GMT Subject: [code-reflection] Integrated: Fix regression in last PR In-Reply-To: References: Message-ID: <06NEiasU0I8o22tTitGsWiO7AGBi48Yhn7nJEgjHQaM=.0399d976-a01c-48f8-84a5-0e29f7840426@github.com> On Wed, 17 Dec 2025 13:48:33 GMT, Gary Frost wrote: > Turns out a VarOp instanceof check does not work here. For NVidia This pull request has now been integrated. Changeset: 7e1b9c9c Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/7e1b9c9cfa2ae342ba9e684c1c27169d8e7e2ef0 Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod Fix regression in last PR ------------- PR: https://git.openjdk.org/babylon/pull/756 From gfrost at openjdk.org Wed Dec 17 13:59:22 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 17 Dec 2025 13:59:22 GMT Subject: git: openjdk/babylon: code-reflection: Fix regression in last PR Message-ID: Changeset: 7e1b9c9c Branch: code-reflection Author: Gary Frost Date: 2025-12-17 13:53:59 +0000 URL: https://git.openjdk.org/babylon/commit/7e1b9c9cfa2ae342ba9e684c1c27169d8e7e2ef0 Fix regression in last PR ! hat/core/src/main/java/hat/optools/OpTk.java From gfrost at openjdk.org Wed Dec 17 16:03:45 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 17 Dec 2025 16:03:45 GMT Subject: git: openjdk/babylon: code-reflection: Removing opencl and cuda warnings nvidia Message-ID: <29bf5975-47ea-4f0b-b85c-66d4559b6a75@openjdk.org> Changeset: c7e76267 Branch: code-reflection Author: Gary Frost Date: 2025-12-17 15:58:47 +0000 URL: https://git.openjdk.org/babylon/commit/c7e762679192cd257c64f869b08205343bbce25d Removing opencl and cuda warnings nvidia ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java ! hat/backends/ffi/cuda/src/main/native/cpp/squares.cpp ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLHATKernelBuilder.java ! hat/backends/ffi/opencl/src/main/native/cpp/squares.cpp ! hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLJExtractedHATKernelBuilder.java ! hat/examples/life/src/main/java/life/Main.java ! hat/examples/violajones/src/main/java/violajones/attic/ViolaJones.java ! hat/intellij/.idea/vcs.xml ! hat/tests/src/main/java/hat/test/TestArrayView.java ! hat/tests/src/main/java/hat/test/TestFloat2.java ! hat/tests/src/main/java/hat/test/TestMatMul.java ! hat/tests/src/main/java/hat/test/TestVectorArrayView.java ! hat/tests/src/main/java/hat/test/TestVectorTypes.java From jfumero at openjdk.org Wed Dec 17 16:04:26 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 17 Dec 2025 16:04:26 GMT Subject: [babylon-docs:master] RFR: Minor typos fixed for the Triton article Message-ID: Minor typos fixed for the Triton article ------------- Commit messages: - Minor typos fixed for the Triton article Changes: https://git.openjdk.org/babylon-docs/pull/14/files Webrev: https://webrevs.openjdk.org/?repo=babylon-docs&pr=14&range=00 Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.org/babylon-docs/pull/14.diff Fetch: git fetch https://git.openjdk.org/babylon-docs.git pull/14/head:pull/14 PR: https://git.openjdk.org/babylon-docs/pull/14 From gfrost at openjdk.org Wed Dec 17 16:05:22 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 17 Dec 2025 16:05:22 GMT Subject: [code-reflection] Integrated: Removing opencl and cuda warnings nvidia Message-ID: On Nvidia machines opencl and cuda reported warnings about unused vars in generated C99 code. ------------- Commit messages: - Removing opencl and cuda warnings nvidia Changes: https://git.openjdk.org/babylon/pull/757/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=757&range=00 Stats: 22 lines in 13 files changed: 1 ins; 3 del; 18 mod Patch: https://git.openjdk.org/babylon/pull/757.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/757/head:pull/757 PR: https://git.openjdk.org/babylon/pull/757 From gfrost at openjdk.org Wed Dec 17 16:05:23 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 17 Dec 2025 16:05:23 GMT Subject: [code-reflection] Integrated: Removing opencl and cuda warnings nvidia In-Reply-To: References: Message-ID: On Wed, 17 Dec 2025 15:55:41 GMT, Gary Frost wrote: > On Nvidia machines opencl and cuda reported warnings about unused vars in generated C99 code. This pull request has now been integrated. Changeset: c7e76267 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/c7e762679192cd257c64f869b08205343bbce25d Stats: 22 lines in 13 files changed: 1 ins; 3 del; 18 mod Removing opencl and cuda warnings nvidia ------------- PR: https://git.openjdk.org/babylon/pull/757 From psandoz at openjdk.org Wed Dec 17 16:42:22 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 17 Dec 2025 16:42:22 GMT Subject: [babylon-docs:master] RFR: Minor typos fixed for the Triton article In-Reply-To: References: Message-ID: <3FyQMvZ34VINEQqJZRd6_jYxDS_0LoM-LrYnUgU_gI8=.4b1208b7-c6a3-4e69-94a7-79c176bf7f6a@github.com> On Wed, 17 Dec 2025 15:55:00 GMT, Juan Fumero wrote: > Minor typos fixed for the Triton article Marked as reviewed by psandoz (Lead). ------------- PR Review: https://git.openjdk.org/babylon-docs/pull/14#pullrequestreview-3588608375 From psandoz at openjdk.org Wed Dec 17 16:53:24 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 17 Dec 2025 16:53:24 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v2] In-Reply-To: References: Message-ID: On Wed, 17 Dec 2025 10:28:10 GMT, Mourad Abbay wrote: >> Write test to make sure java version check we do before building models is working. >> There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Run the tests in two steps Also test a reflectable lambda expression. ------------- PR Review: https://git.openjdk.org/babylon/pull/748#pullrequestreview-3588659540 From jfumero at openjdk.org Wed Dec 17 17:03:18 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 17 Dec 2025 17:03:18 GMT Subject: [babylon-docs:master] Integrated: Minor typos fixed for the Triton article In-Reply-To: References: Message-ID: On Wed, 17 Dec 2025 15:55:00 GMT, Juan Fumero wrote: > Minor typos fixed for the Triton article This pull request has now been integrated. Changeset: 6f771512 Author: Juan Fumero URL: https://git.openjdk.org/babylon-docs/commit/6f77151253d60b84325d5b84cb22a1af75c5be83 Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod Minor typos fixed for the Triton article Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon-docs/pull/14 From gfrost at openjdk.org Wed Dec 17 17:05:20 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 17 Dec 2025 17:05:20 GMT Subject: git: openjdk/babylon: code-reflection: Created optkl subproject containing tooling that does not depend on HAT Message-ID: <8919feef-0d48-4c6d-8266-7afb813ff4b0@openjdk.org> Changeset: ed10cfe2 Branch: code-reflection Author: Gary Frost Date: 2025-12-17 17:02:11 +0000 URL: https://git.openjdk.org/babylon/commit/ed10cfe20347324e8af53f244a49b89674a2c809 Created optkl subproject containing tooling that does not depend on HAT ! hat/core/pom.xml ! hat/core/src/main/java/hat/ifacemapper/accessor/AccessorInfo.java - hat/core/src/main/java/hat/util/StreamOptionalMutable.java ! hat/examples/view/src/main/java/view/EliteMeshParser.java ! hat/hat.java ! hat/intellij/.idea/modules.xml ! hat/intellij/.idea/vcs.xml ! hat/intellij/core.iml ! hat/intellij/example_view.iml + hat/intellij/optkl.iml ! hat/intellij/tests.iml ! hat/intellij/tools.iml = hat/optkl/pom.xml = hat/optkl/src/main/java/optkl/OpCodeBuilder.java + hat/optkl/src/main/java/optkl/OpTkl.java = hat/optkl/src/main/java/optkl/Regex.java = hat/optkl/src/main/java/optkl/jdot/DotBuilder.java = hat/optkl/src/main/java/optkl/jdot/ui/JDot.java = hat/optkl/src/main/java/optkl/json/Json.java = hat/optkl/src/main/java/optkl/json/JsonArray.java = hat/optkl/src/main/java/optkl/json/JsonBoolean.java = hat/optkl/src/main/java/optkl/json/JsonNull.java = hat/optkl/src/main/java/optkl/json/JsonNumber.java = hat/optkl/src/main/java/optkl/json/JsonObject.java = hat/optkl/src/main/java/optkl/json/JsonParseException.java = hat/optkl/src/main/java/optkl/json/JsonString.java = hat/optkl/src/main/java/optkl/json/JsonValue.java = hat/optkl/src/main/java/optkl/json/impl/JsonArrayImpl.java = hat/optkl/src/main/java/optkl/json/impl/JsonBooleanImpl.java = hat/optkl/src/main/java/optkl/json/impl/JsonNullImpl.java = hat/optkl/src/main/java/optkl/json/impl/JsonNumberImpl.java = hat/optkl/src/main/java/optkl/json/impl/JsonObjectImpl.java = hat/optkl/src/main/java/optkl/json/impl/JsonParser.java = hat/optkl/src/main/java/optkl/json/impl/JsonStringImpl.java = hat/optkl/src/main/java/optkl/json/impl/Utils.java = hat/optkl/src/main/java/optkl/textmodel/BabylonTextModel.java = hat/optkl/src/main/java/optkl/textmodel/Cursor.java + hat/optkl/src/main/java/optkl/textmodel/JavaTextModel.java = hat/optkl/src/main/java/optkl/textmodel/TextModel.java = hat/optkl/src/main/java/optkl/textmodel/html/Spanner.java = hat/optkl/src/main/java/optkl/textmodel/html/tokens/GT_ENTITY.java = hat/optkl/src/main/java/optkl/textmodel/html/tokens/LT_ENTITY.java = hat/optkl/src/main/java/optkl/textmodel/terminal/ANSI.java = hat/optkl/src/main/java/optkl/textmodel/terminal/CodeModelFormatter.java = hat/optkl/src/main/java/optkl/textmodel/terminal/TestANSI.java = hat/optkl/src/main/java/optkl/textmodel/tokens/AbstractParentToken.java = hat/optkl/src/main/java/optkl/textmodel/tokens/AbstractToken.java = hat/optkl/src/main/java/optkl/textmodel/tokens/AbstractTokenWithCh.java = hat/optkl/src/main/java/optkl/textmodel/tokens/AbstractTokenWithLength.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Arrow.java = hat/optkl/src/main/java/optkl/textmodel/tokens/At.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Ch.java = hat/optkl/src/main/java/optkl/textmodel/tokens/CharLiteral.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Close.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Comment.java = hat/optkl/src/main/java/optkl/textmodel/tokens/DottedName.java + hat/optkl/src/main/java/optkl/textmodel/tokens/Factory.java = hat/optkl/src/main/java/optkl/textmodel/tokens/FloatConst.java = hat/optkl/src/main/java/optkl/textmodel/tokens/IntConst.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Leaf.java = hat/optkl/src/main/java/optkl/textmodel/tokens/LeafReplacementToken.java = hat/optkl/src/main/java/optkl/textmodel/tokens/LineCol.java = hat/optkl/src/main/java/optkl/textmodel/tokens/LineComment.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Literal.java = hat/optkl/src/main/java/optkl/textmodel/tokens/MultiLineComment.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Nl.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Open.java = hat/optkl/src/main/java/optkl/textmodel/tokens/OpenClose.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Parent.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Parenthesis.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Pos.java = hat/optkl/src/main/java/optkl/textmodel/tokens/ReservedWord.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Root.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Seq.java = hat/optkl/src/main/java/optkl/textmodel/tokens/SingleCharLeaf.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Span.java = hat/optkl/src/main/java/optkl/textmodel/tokens/StringLiteral.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Token.java = hat/optkl/src/main/java/optkl/textmodel/tokens/Ws.java + hat/optkl/src/main/java/optkl/textmodel/tokens/defaults/Ch.java + hat/optkl/src/main/java/optkl/textmodel/tokens/defaults/CharLiteral.java + hat/optkl/src/main/java/optkl/textmodel/tokens/defaults/Close.java + hat/optkl/src/main/java/optkl/textmodel/tokens/defaults/LineComment.java + hat/optkl/src/main/java/optkl/textmodel/tokens/defaults/MultiLineComment.java + hat/optkl/src/main/java/optkl/textmodel/tokens/defaults/Nl.java + hat/optkl/src/main/java/optkl/textmodel/tokens/defaults/Open.java + hat/optkl/src/main/java/optkl/textmodel/tokens/defaults/Parenthesis.java + hat/optkl/src/main/java/optkl/textmodel/tokens/defaults/Seq.java + hat/optkl/src/main/java/optkl/textmodel/tokens/defaults/StringLiteral.java + hat/optkl/src/main/java/optkl/textmodel/tokens/defaults/Ws.java = hat/optkl/src/main/java/optkl/textmodel/ui/BabylonStyleMapper.java = hat/optkl/src/main/java/optkl/textmodel/ui/ElementSpan.java = hat/optkl/src/main/java/optkl/textmodel/ui/FuncOpTextModelViewer.java = hat/optkl/src/main/java/optkl/textmodel/ui/FuncOpViewer.java = hat/optkl/src/main/java/optkl/textmodel/ui/JavaTextModelViewer.java = hat/optkl/src/main/java/optkl/textmodel/ui/SSAIDViewer.java + hat/optkl/src/main/java/optkl/textmodel/ui/StyleMapper.java = hat/optkl/src/main/java/optkl/textmodel/ui/TextGutter.java = hat/optkl/src/main/java/optkl/textmodel/ui/TextModelViewer.java + hat/optkl/target/antrun/build-main.xml + hat/optkl/target/classes/optkl/OpTkl.class + hat/optkl/target/hat-optkl-1.0.jar + hat/optkl/target/maven-archiver/pom.properties + hat/optkl/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst + hat/optkl/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst ! hat/pom.xml ! hat/tools/src/main/java/hat/tools/text/TestJavaHATCodeBuilder.java - hat/tools/src/main/java/hat/tools/textmodel/JavaTextModel.java - hat/tools/src/main/java/hat/tools/textmodel/tokens/Factory.java - hat/tools/src/main/java/hat/tools/textmodel/tokens/defaults/Ch.java - hat/tools/src/main/java/hat/tools/textmodel/tokens/defaults/CharLiteral.java - hat/tools/src/main/java/hat/tools/textmodel/tokens/defaults/Close.java - hat/tools/src/main/java/hat/tools/textmodel/tokens/defaults/LineComment.java - hat/tools/src/main/java/hat/tools/textmodel/tokens/defaults/MultiLineComment.java - hat/tools/src/main/java/hat/tools/textmodel/tokens/defaults/Nl.java - hat/tools/src/main/java/hat/tools/textmodel/tokens/defaults/Open.java - hat/tools/src/main/java/hat/tools/textmodel/tokens/defaults/Parenthesis.java - hat/tools/src/main/java/hat/tools/textmodel/tokens/defaults/Seq.java - hat/tools/src/main/java/hat/tools/textmodel/tokens/defaults/StringLiteral.java - hat/tools/src/main/java/hat/tools/textmodel/tokens/defaults/Ws.java - hat/tools/src/main/java/hat/tools/textmodel/ui/StyleMapper.java - hat/tools/src/main/java/hat/tools/textmodel/ui/TestFuncOpViewer.java From gfrost at openjdk.org Wed Dec 17 17:08:45 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 17 Dec 2025 17:08:45 GMT Subject: [code-reflection] Integrated: Created optkl subproject containing tooling that does not depend on HAT Message-ID: I created optkl subproject. It contains a bunch of useful tooling that leverage babylon, but does not have depenencies on HAT itself. I plan to move the non HAT code builders down here as well as the iface mapper eventually. ------------- Commit messages: - Created optkl subproject containing tooling that does not depend on HAT Changes: https://git.openjdk.org/babylon/pull/758/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=758&range=00 Stats: 1675 lines in 122 files changed: 717 ins; 778 del; 180 mod Patch: https://git.openjdk.org/babylon/pull/758.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/758/head:pull/758 PR: https://git.openjdk.org/babylon/pull/758 From gfrost at openjdk.org Wed Dec 17 17:08:46 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 17 Dec 2025 17:08:46 GMT Subject: [code-reflection] Integrated: Created optkl subproject containing tooling that does not depend on HAT In-Reply-To: References: Message-ID: <3CnuSP2ZJeSe99rv0Lw-4zjiovSFHQVBAitmdbVPYPg=.f0165756-442d-463c-8118-4d32f5546c5a@github.com> On Wed, 17 Dec 2025 16:59:05 GMT, Gary Frost wrote: > I created optkl subproject. > > It contains a bunch of useful tooling that leverage babylon, but does not have depenencies on HAT itself. > > I plan to move the non HAT code builders down here as well as the iface mapper eventually. This pull request has now been integrated. Changeset: ed10cfe2 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/ed10cfe20347324e8af53f244a49b89674a2c809 Stats: 1675 lines in 122 files changed: 717 ins; 778 del; 180 mod Created optkl subproject containing tooling that does not depend on HAT ------------- PR: https://git.openjdk.org/babylon/pull/758 From mabbay at openjdk.org Wed Dec 17 20:19:16 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 17 Dec 2025 20:19:16 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v3] In-Reply-To: References: Message-ID: > Write test to make sure java version check we do before building models is working. > There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. Mourad Abbay has updated the pull request incrementally with two additional commits since the last revision: - Test reflectable lambda - Apply suggestion ------------- Changes: - all: https://git.openjdk.org/babylon/pull/748/files - new: https://git.openjdk.org/babylon/pull/748/files/c4249a63..6aabfef1 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=748&range=02 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=748&range=01-02 Stats: 19 lines in 2 files changed: 14 ins; 3 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/748.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/748/head:pull/748 PR: https://git.openjdk.org/babylon/pull/748 From psandoz at openjdk.org Wed Dec 17 22:53:43 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 17 Dec 2025 22:53:43 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v3] In-Reply-To: References: Message-ID: On Wed, 17 Dec 2025 20:19:16 GMT, Mourad Abbay wrote: >> Write test to make sure java version check we do before building models is working. >> There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. > > Mourad Abbay has updated the pull request incrementally with two additional commits since the last revision: > > - Test reflectable lambda > - Apply suggestion test/jdk/java/lang/reflect/code/writer/TestJavaVersionChecker.java line 35: > 33: void test() throws ReflectiveOperationException, IOException { > 34: Method m = this.getClass().getDeclaredMethod("max", int.class, int.class); > 35: Assertions.assertThrows(UnsupportedOperationException.class, () -> Op.ofMethod(m)); What happens if you call `Op.ofMethod` again after the first failure? test/jdk/java/lang/reflect/code/writer/TestJavaVersionChecker.java line 48: > 46: ie = e; > 47: } > 48: Assertions.assertNotNull(ie, "Reflectable lambda creation didn't fail as expected"); Recommend you separate out the tests for methods and lambdas. The behavior for lambdas is an unfortunate deviation from that of methods, and it's hard to diagnose and occurs at a distance from where the quoted code model is requested. We need to be consistent, which indicates we have to revisit how we load the code model and extract the quoted code model. At the moment the code model is loaded (built) when the LMF inner class is initialized, and the quoted code model extracted when the inner class is instantiated. We should really be lazy. We might have discussed that but avoided it due to the additional complexity in an already complex area. Now we have a better understanding we can revisit. Let's do so in another PR. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/748#discussion_r2628841429 PR Review Comment: https://git.openjdk.org/babylon/pull/748#discussion_r2628898871 From jfumero at openjdk.org Thu Dec 18 10:20:26 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Thu, 18 Dec 2025 10:20:26 GMT Subject: [code-reflection] RFR: [hat] Rollback specific buffer-accessor for OpenCL buffer allocation Message-ID: [hat] Rollback specific buffer-accessor for OpenCL buffer allocation ------------- Commit messages: - [hat] cuda-backend fixed - [hat] memory buffer accessor rollback to RW Changes: https://git.openjdk.org/babylon/pull/759/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=759&range=00 Stats: 21 lines in 9 files changed: 0 ins; 7 del; 14 mod Patch: https://git.openjdk.org/babylon/pull/759.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/759/head:pull/759 PR: https://git.openjdk.org/babylon/pull/759 From jfumero at openjdk.org Thu Dec 18 10:31:18 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Thu, 18 Dec 2025 10:31:18 GMT Subject: git: openjdk/babylon: code-reflection: [hat] Rollback specific buffer-accessor for OpenCL buffer allocation Message-ID: <9d2f9e61-b4cd-4370-b1d2-daaf87eecfae@openjdk.org> Changeset: 61e1ba71 Branch: code-reflection Author: Juan Fumero Date: 2025-12-18 10:30:43 +0000 URL: https://git.openjdk.org/babylon/commit/61e1ba7178c9eb483d814f9ad71d0a5650760559 [hat] Rollback specific buffer-accessor for OpenCL buffer allocation ! hat/backends/ffi/cuda/src/main/native/cpp/cuda_backend.cpp ! hat/backends/ffi/cuda/src/main/native/cpp/cuda_backend_buffer.cpp ! hat/backends/ffi/cuda/src/main/native/include/cuda_backend.h ! hat/backends/ffi/mock/src/main/native/cpp/mock_backend.cpp ! hat/backends/ffi/opencl/src/main/native/cpp/opencl_backend.cpp ! hat/backends/ffi/opencl/src/main/native/cpp/opencl_backend_buffer.cpp ! hat/backends/ffi/opencl/src/main/native/include/opencl_backend.h ! hat/backends/ffi/shared/src/main/native/cpp/shared.cpp ! hat/backends/ffi/shared/src/main/native/include/shared.h From jfumero at openjdk.org Thu Dec 18 10:33:25 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Thu, 18 Dec 2025 10:33:25 GMT Subject: [code-reflection] Integrated: [hat] Rollback specific buffer-accessor for OpenCL buffer allocation In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 10:15:15 GMT, Juan Fumero wrote: > [hat] Rollback specific buffer-accessor for OpenCL buffer allocation This pull request has now been integrated. Changeset: 61e1ba71 Author: Juan Fumero URL: https://git.openjdk.org/babylon/commit/61e1ba7178c9eb483d814f9ad71d0a5650760559 Stats: 21 lines in 9 files changed: 0 ins; 7 del; 14 mod [hat] Rollback specific buffer-accessor for OpenCL buffer allocation ------------- PR: https://git.openjdk.org/babylon/pull/759 From gfrost at openjdk.org Thu Dec 18 10:36:33 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 18 Dec 2025 10:36:33 GMT Subject: git: openjdk/babylon: code-reflection: Isolating iface mapper so it can be used outside of HAT Message-ID: <859515f3-8c57-4634-8889-86c3a576041a@openjdk.org> Changeset: ed0b4dab Branch: code-reflection Author: Gary Frost Date: 2025-12-18 10:33:37 +0000 URL: https://git.openjdk.org/babylon/commit/ed0b4dab66c05bdafdd1fa2fd1e317da7fbcd9bc Isolating iface mapper so it can be used outside of HAT ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackendDriver.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/C99JExtractedBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackendDriver.java ! hat/core/src/main/java/hat/Accelerator.java ! hat/core/src/main/java/hat/BufferTagger.java ! hat/core/src/main/java/hat/ComputeContext.java ! hat/core/src/main/java/hat/backend/Backend.java ! hat/core/src/main/java/hat/backend/BackendAdaptor.java ! hat/core/src/main/java/hat/backend/java/JavaBackend.java ! hat/core/src/main/java/hat/buffer/ArgArray.java ! hat/core/src/main/java/hat/buffer/BF16Array.java - hat/core/src/main/java/hat/buffer/Buffer.java - hat/core/src/main/java/hat/buffer/BufferAllocator.java - hat/core/src/main/java/hat/buffer/BufferTracker.java ! hat/core/src/main/java/hat/buffer/F16Array.java ! hat/core/src/main/java/hat/buffer/F32Array.java ! hat/core/src/main/java/hat/buffer/F32Array2D.java ! hat/core/src/main/java/hat/buffer/F32ArrayPadded.java ! hat/core/src/main/java/hat/buffer/ImageIfaceBuffer.java ! hat/core/src/main/java/hat/buffer/KernelBufferContext.java ! hat/core/src/main/java/hat/buffer/S32Array.java ! hat/core/src/main/java/hat/buffer/S32Array2D.java ! hat/core/src/main/java/hat/callgraph/ComputeCallGraph.java ! hat/core/src/main/java/hat/callgraph/KernelCallGraph.java ! hat/core/src/main/java/hat/ifacemapper/AbstractSegmentMapper.java ! hat/core/src/main/java/hat/ifacemapper/BoundSchema.java = hat/core/src/main/java/hat/ifacemapper/Buffer.java + hat/core/src/main/java/hat/ifacemapper/BufferAllocator.java ! hat/core/src/main/java/hat/ifacemapper/BufferState.java + hat/core/src/main/java/hat/ifacemapper/BufferTracker.java ! hat/core/src/main/java/hat/ifacemapper/ByteCodeGenerator.java ! hat/core/src/main/java/hat/ifacemapper/MappableIface.java ! hat/core/src/main/java/hat/ifacemapper/MapperCache.java ! hat/core/src/main/java/hat/ifacemapper/MapperUtil.java ! hat/core/src/main/java/hat/ifacemapper/Schema.java = hat/core/src/main/java/hat/ifacemapper/SchemaBuilder.java ! hat/core/src/main/java/hat/ifacemapper/SegmentInterfaceMapper.java ! hat/core/src/main/java/hat/ifacemapper/SegmentMapper.java ! hat/core/src/main/java/hat/ifacemapper/component/Util.java ! hat/examples/experiments/src/main/java/experiments/LayoutExample.java ! hat/examples/experiments/src/main/java/experiments/LocalArray.java ! hat/examples/experiments/src/main/java/experiments/Mesh.java ! hat/examples/experiments/src/main/java/experiments/PrefixSum.java ! hat/examples/experiments/src/main/java/experiments/Reduction.java ! hat/examples/experiments/src/main/java/experiments/S08x3ImageTest.java ! hat/examples/experiments/src/main/java/experiments/S32ArrayTest.java ! hat/examples/experiments/src/main/java/experiments/spirv/MatrixMultiply.java ! hat/examples/heal/src/main/java/heal/Box.java ! hat/examples/heal/src/main/java/heal/XYRGBList.java ! hat/examples/life/src/main/java/life/Main.java ! hat/examples/mandel/src/main/java/mandel/Viewer.java ! hat/examples/nbody/src/main/java/nbody/Universe.java ! hat/examples/violajones/src/main/java/violajones/ifaces/Cascade.java ! hat/examples/violajones/src/main/java/violajones/ifaces/ResultTable.java ! hat/examples/violajones/src/main/java/violajones/ifaces/ScaleTable.java ! hat/hat.java ! hat/tests/src/main/java/hat/test/TestArrayView.java ! hat/tests/src/main/java/hat/test/TestNbody.java ! hat/wraps/opencl/src/main/java/wrap/opencl/CLPlatform.java From gfrost at openjdk.org Thu Dec 18 10:37:19 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 18 Dec 2025 10:37:19 GMT Subject: [code-reflection] Integrated: Isolating iface mapper so it can be used outside of HAT Message-ID: <4_mLf_NixvVBFgDLwwKbAbwXjNLQJ-KdeXdZgENHFuo=.171ed19c-d94f-4710-9fa6-4087aa6775c3@github.com> Ideally we can use iface mapper and schema builder (iface -> MemoryLayout) outside of HAT This is the first step to that end. ------------- Commit messages: - Isolating iface mapper so it can be used outside of HAT Changes: https://git.openjdk.org/babylon/pull/760/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=760&range=00 Stats: 623 lines in 63 files changed: 217 ins; 275 del; 131 mod Patch: https://git.openjdk.org/babylon/pull/760.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/760/head:pull/760 PR: https://git.openjdk.org/babylon/pull/760 From gfrost at openjdk.org Thu Dec 18 10:37:21 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 18 Dec 2025 10:37:21 GMT Subject: [code-reflection] Integrated: Isolating iface mapper so it can be used outside of HAT In-Reply-To: <4_mLf_NixvVBFgDLwwKbAbwXjNLQJ-KdeXdZgENHFuo=.171ed19c-d94f-4710-9fa6-4087aa6775c3@github.com> References: <4_mLf_NixvVBFgDLwwKbAbwXjNLQJ-KdeXdZgENHFuo=.171ed19c-d94f-4710-9fa6-4087aa6775c3@github.com> Message-ID: On Thu, 18 Dec 2025 10:30:43 GMT, Gary Frost wrote: > Ideally we can use iface mapper and schema builder (iface -> MemoryLayout) outside of HAT > > This is the first step to that end. This pull request has now been integrated. Changeset: ed0b4dab Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/ed0b4dab66c05bdafdd1fa2fd1e317da7fbcd9bc Stats: 623 lines in 63 files changed: 217 ins; 275 del; 131 mod Isolating iface mapper so it can be used outside of HAT ------------- PR: https://git.openjdk.org/babylon/pull/760 From gfrost at openjdk.org Thu Dec 18 12:10:06 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 18 Dec 2025 12:10:06 GMT Subject: [code-reflection] Integrated: Codebuilders are useful in some common optkl tooling Message-ID: Some of the optkl tooling benefits from HAT style code builders. So we moved these down. ------------- Commit messages: - Codebuilders are useful in some common optkl tooling Changes: https://git.openjdk.org/babylon/pull/761/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=761&range=00 Stats: 2220 lines in 40 files changed: 1090 ins; 1088 del; 42 mod Patch: https://git.openjdk.org/babylon/pull/761.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/761/head:pull/761 PR: https://git.openjdk.org/babylon/pull/761 From gfrost at openjdk.org Thu Dec 18 12:10:09 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 18 Dec 2025 12:10:09 GMT Subject: [code-reflection] Integrated: Codebuilders are useful in some common optkl tooling In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 12:01:49 GMT, Gary Frost wrote: > Some of the optkl tooling benefits from HAT style code builders. So we moved these down. This pull request has now been integrated. Changeset: 2c3959ec Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/2c3959ec51b225b0eed506d3e7164fc5a284ada4 Stats: 2220 lines in 40 files changed: 1090 ins; 1088 del; 42 mod Codebuilders are useful in some common optkl tooling ------------- PR: https://git.openjdk.org/babylon/pull/761 From gfrost at openjdk.org Thu Dec 18 12:12:23 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 18 Dec 2025 12:12:23 GMT Subject: git: openjdk/babylon: code-reflection: Codebuilders are useful in some common optkl tooling Message-ID: <09d3beca-fe07-40f9-b3ca-5e3217d29839@openjdk.org> Changeset: 2c3959ec Branch: code-reflection Author: Gary Frost Date: 2025-12-18 12:06:40 +0000 URL: https://git.openjdk.org/babylon/commit/2c3959ec51b225b0eed506d3e7164fc5a284ada4 Codebuilders are useful in some common optkl tooling ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/PTXHATKernelBuilder.java ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLHATKernelBuilder.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLJExtractedHATKernelBuilder.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/core/src/main/java/hat/FFIConfigCreator.java ! hat/core/src/main/java/hat/callgraph/ComputeCallGraph.java - hat/core/src/main/java/hat/codebuilders/BabylonCoreOpBuilder.java ! hat/core/src/main/java/hat/codebuilders/BabylonKernelOpBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java - hat/core/src/main/java/hat/codebuilders/CodeBuilder.java - hat/core/src/main/java/hat/codebuilders/CodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/ScopedCodeBuilderContext.java ! hat/core/src/main/java/hat/ifacemapper/MapperUtil.java ! hat/core/src/main/java/hat/ifacemapper/SchemaBuilder.java ! hat/core/src/main/java/hat/optools/OpTk.java - hat/core/src/main/java/hat/util/BiMap.java ! hat/examples/view/src/main/java/view/EliteMeshParser.java ! hat/examples/view/src/main/java/view/f32/F32Mesh3D.java ! hat/intellij/backend_ffi_cuda.iml ! hat/intellij/backend_ffi_opencl.iml ! hat/intellij/backend_ffi_shared.iml ! hat/intellij/backend_jextracted_opencl.iml ! hat/intellij/backend_jextracted_shared.iml ! hat/intellij/example_experiments.iml + hat/optkl/src/main/java/optkl/BiMap.java = hat/optkl/src/main/java/optkl/FuncOpParams.java + hat/optkl/src/main/java/optkl/ParamVar.java = hat/optkl/src/main/java/optkl/StreamMutable.java + hat/optkl/src/main/java/optkl/codebuilders/BabylonCoreOpBuilder.java + hat/optkl/src/main/java/optkl/codebuilders/CodeBuilder.java + hat/optkl/src/main/java/optkl/codebuilders/CodeBuilderContext.java = hat/optkl/src/main/java/optkl/codebuilders/CodeRenderer.java = hat/optkl/src/main/java/optkl/codebuilders/TextBuilder.java ! hat/tools/src/main/java/hat/tools/text/JavaHATCodeBuilder.java From asotona at openjdk.org Thu Dec 18 12:48:10 2025 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 18 Dec 2025 12:48:10 GMT Subject: [code-reflection] RFR: Unreflect tests Message-ID: This PR implement `Unreflect` test tool and re-runs tests in the unreflected form. `TestSwitchExpressionOp` and `TestSwitchStatementOp` yet to be temporary excluded as failing. ------------- Commit messages: - fixed long lines - unreflect tests Changes: https://git.openjdk.org/babylon/pull/762/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=762&range=00 Stats: 353 lines in 86 files changed: 352 ins; 1 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/762.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/762/head:pull/762 PR: https://git.openjdk.org/babylon/pull/762 From gfrost at openjdk.org Thu Dec 18 12:59:38 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 18 Dec 2025 12:59:38 GMT Subject: git: openjdk/babylon: code-reflection: Moved the generation of random suffix for schema padding to codegen Message-ID: <16f0957e-6473-4f7b-afd6-d22756017b6e@openjdk.org> Changeset: cc930a88 Branch: code-reflection Author: Gary Frost Date: 2025-12-18 12:57:37 +0000 URL: https://git.openjdk.org/babylon/commit/cc930a884ef0db0e523a8685ed86f9595058e375 Moved the generation of random suffix for schema padding to codegen ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/ifacemapper/Schema.java From gfrost at openjdk.org Thu Dec 18 13:00:51 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 18 Dec 2025 13:00:51 GMT Subject: [code-reflection] Integrated: Moved the generation of random suffix for schema padding to codegen Message-ID: As I experiment with schema building. I noticed some codegen code (random pading suffix) in the schema code itself. I moved this to the C99 code gen. ------------- Commit messages: - Moved the generation of random suffix for schema padding to codegen Changes: https://git.openjdk.org/babylon/pull/763/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=763&range=00 Stats: 44 lines in 2 files changed: 15 ins; 27 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/763.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/763/head:pull/763 PR: https://git.openjdk.org/babylon/pull/763 From gfrost at openjdk.org Thu Dec 18 13:00:52 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 18 Dec 2025 13:00:52 GMT Subject: [code-reflection] Integrated: Moved the generation of random suffix for schema padding to codegen In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 12:54:11 GMT, Gary Frost wrote: > As I experiment with schema building. I noticed some codegen code (random pading suffix) in the schema code itself. > > I moved this to the C99 code gen. This pull request has now been integrated. Changeset: cc930a88 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/cc930a884ef0db0e523a8685ed86f9595058e375 Stats: 44 lines in 2 files changed: 15 ins; 27 del; 2 mod Moved the generation of random suffix for schema padding to codegen ------------- PR: https://git.openjdk.org/babylon/pull/763 From asotona at openjdk.org Thu Dec 18 14:24:59 2025 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 18 Dec 2025 14:24:59 GMT Subject: [code-reflection] RFR: Unreflect tests [v2] In-Reply-To: References: Message-ID: > This PR implement `Unreflect` test tool and re-runs tests in the unreflected form. > > `TestSwitchExpressionOp` and `TestSwitchStatementOp` yet to be temporary excluded as failing. Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: simplification ------------- Changes: - all: https://git.openjdk.org/babylon/pull/762/files - new: https://git.openjdk.org/babylon/pull/762/files/c3118ba2..c17e1825 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=762&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=762&range=00-01 Stats: 57 lines in 1 file changed: 0 ins; 34 del; 23 mod Patch: https://git.openjdk.org/babylon/pull/762.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/762/head:pull/762 PR: https://git.openjdk.org/babylon/pull/762 From asotona at openjdk.org Thu Dec 18 14:44:14 2025 From: asotona at openjdk.org (Adam Sotona) Date: Thu, 18 Dec 2025 14:44:14 GMT Subject: [code-reflection] RFR: Unreflect tests [v3] In-Reply-To: References: Message-ID: > This PR implement `Unreflect` test tool and re-runs tests in the unreflected form. > > `TestSwitchExpressionOp` and `TestSwitchStatementOp` yet to be temporary excluded as failing (see [JDK-8373573](https://bugs.openjdk.org/browse/JDK-8373573)). Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: - obsolete debug print - new line ------------- Changes: - all: https://git.openjdk.org/babylon/pull/762/files - new: https://git.openjdk.org/babylon/pull/762/files/c17e1825..ff2ff45e Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=762&range=02 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=762&range=01-02 Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/762.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/762/head:pull/762 PR: https://git.openjdk.org/babylon/pull/762 From psandoz at openjdk.org Thu Dec 18 18:11:27 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 18 Dec 2025 18:11:27 GMT Subject: [code-reflection] RFR: Unreflect tests [v3] In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 14:44:14 GMT, Adam Sotona wrote: >> This PR implement `Unreflect` test tool and re-runs tests in the unreflected form. >> >> `TestSwitchExpressionOp` and `TestSwitchStatementOp` yet to be temporary excluded as failing (see [JDK-8373573](https://bugs.openjdk.org/browse/JDK-8373573)). > > Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: > > - obsolete debug print > > - new line This is a very nice approach. There are some tests where reflectable methods are never invoked e.g., `CoreBinaryOpsTest`, which tests the model in the interpreter and explicitly generated bytecode, in this case we arguably should also test direct invocation So i think it may be worth going through and checking as not all tests need to be modified and some might be to ensure larger converage. Further, with this test do we need as many specific bytecode tests? can we simplify or reduce those now? Any thoughts on how we might apply the same approach to reflectable lambdas? I guess we can rewrite the invoke dynamic instructions. ------------- PR Review: https://git.openjdk.org/babylon/pull/762#pullrequestreview-3594294003 From gfrost at openjdk.org Thu Dec 18 18:29:27 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 18 Dec 2025 18:29:27 GMT Subject: [code-reflection] Integrated: switching to new transformer pattern - ThreadsPhase Message-ID: Switched ThreadsPhase to use new transformer pattern. ------------- Commit messages: - switching to new transformer pattern - ThreadsPhase Changes: https://git.openjdk.org/babylon/pull/764/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=764&range=00 Stats: 183 lines in 8 files changed: 69 ins; 71 del; 43 mod Patch: https://git.openjdk.org/babylon/pull/764.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/764/head:pull/764 PR: https://git.openjdk.org/babylon/pull/764 From gfrost at openjdk.org Thu Dec 18 18:29:28 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 18 Dec 2025 18:29:28 GMT Subject: [code-reflection] Integrated: switching to new transformer pattern - ThreadsPhase In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 18:22:31 GMT, Gary Frost wrote: > Switched ThreadsPhase to use new transformer pattern. This pull request has now been integrated. Changeset: 5e828206 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/5e828206d54d35a4ca91deeb5550d590622420d6 Stats: 183 lines in 8 files changed: 69 ins; 71 del; 43 mod switching to new transformer pattern - ThreadsPhase ------------- PR: https://git.openjdk.org/babylon/pull/764 From gfrost at openjdk.org Thu Dec 18 18:30:31 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 18 Dec 2025 18:30:31 GMT Subject: git: openjdk/babylon: code-reflection: switching to new transformer pattern - ThreadsPhase Message-ID: Changeset: 5e828206 Branch: code-reflection Author: Gary Frost Date: 2025-12-18 18:26:21 +0000 URL: https://git.openjdk.org/babylon/commit/5e828206d54d35a4ca91deeb5550d590622420d6 switching to new transformer pattern - ThreadsPhase ! hat/core/src/main/java/hat/dialect/HATBlockThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATLocalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATLocalThreadIdOp.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/optools/Trxfmr.java ! hat/core/src/main/java/hat/phases/HATDialectifyThreadsPhase.java From mabbay at openjdk.org Thu Dec 18 20:15:22 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Thu, 18 Dec 2025 20:15:22 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v4] In-Reply-To: References: Message-ID: > Write test to make sure java version check we do before building models is working. > There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Separate test for method from test for lambda ------------- Changes: - all: https://git.openjdk.org/babylon/pull/748/files - new: https://git.openjdk.org/babylon/pull/748/files/6aabfef1..680ce7aa Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=748&range=03 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=748&range=02-03 Stats: 223 lines in 3 files changed: 125 ins; 98 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/748.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/748/head:pull/748 PR: https://git.openjdk.org/babylon/pull/748 From mabbay at openjdk.org Thu Dec 18 20:15:26 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Thu, 18 Dec 2025 20:15:26 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v3] In-Reply-To: References: Message-ID: On Wed, 17 Dec 2025 22:50:32 GMT, Paul Sandoz wrote: >> Mourad Abbay has updated the pull request incrementally with two additional commits since the last revision: >> >> - Test reflectable lambda >> - Apply suggestion > > test/jdk/java/lang/reflect/code/writer/TestJavaVersionChecker.java line 48: > >> 46: ie = e; >> 47: } >> 48: Assertions.assertNotNull(ie, "Reflectable lambda creation didn't fail as expected"); > > Recommend you separate out the tests for methods and lambdas. > > The behavior for lambdas is an unfortunate deviation from that of methods, and it's hard to diagnose and occurs at a distance from where the quoted code model is requested. We need to be consistent, which indicates we have to revisit how we load the code model and extract the quoted code model. At the moment the code model is loaded (built) when the LMF inner class is initialized, and the quoted code model extracted when the inner class is instantiated. We should really be lazy. We might have discussed that but avoided it due to the additional complexity in an already complex area. Now we have a better understanding we can revisit. Let's do so in another PR. I Will do it in a subsequent PR. > test/jdk/java/lang/reflect/code/writer/TestJavaVersionCheckerForMethods.java line 35: > >> (failed to retrieve contents of file, check the PR for context) > What happens if you call `Op.ofMethod` again after the first failure? It will throw the `UnsupportedOperationException`. Did you expect a different behaviour ? ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/748#discussion_r2632485718 PR Review Comment: https://git.openjdk.org/babylon/pull/748#discussion_r2632492701 From psandoz at openjdk.org Thu Dec 18 20:30:39 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 18 Dec 2025 20:30:39 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v4] In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 20:15:22 GMT, Mourad Abbay wrote: >> Write test to make sure java version check we do before building models is working. >> There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Separate test for method from test for lambda Marked as reviewed by psandoz (Lead). ------------- PR Review: https://git.openjdk.org/babylon/pull/748#pullrequestreview-3594915873 From psandoz at openjdk.org Thu Dec 18 20:30:41 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 18 Dec 2025 20:30:41 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v3] In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 20:12:36 GMT, Mourad Abbay wrote: >> test/jdk/java/lang/reflect/code/writer/TestJavaVersionCheckerForMethods.java line 35: >> >>> (failed to retrieve contents of file, check the PR for context) >> What happens if you call `Op.ofMethod` again after the first failure? > > It will throw the `UnsupportedOperationException`. Did you expect a different behaviour ? No, but we should test that. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/748#discussion_r2632526943 From duke at openjdk.org Thu Dec 18 20:48:15 2025 From: duke at openjdk.org (Ruby Chen) Date: Thu, 18 Dec 2025 20:48:15 GMT Subject: [code-reflection] RFR: Add HATPtrOps to array view Message-ID: Add four new HATPtrOps to support array views. Also update array view tests and add a new test to check for correct memory copies for a write only buffer. Minor change in BufferTagger to change access types into bytes. ------------- Commit messages: - Add HATPtrOps to array view Changes: https://git.openjdk.org/babylon/pull/765/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=765&range=00 Stats: 700 lines in 12 files changed: 474 ins; 159 del; 67 mod Patch: https://git.openjdk.org/babylon/pull/765.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/765/head:pull/765 PR: https://git.openjdk.org/babylon/pull/765 From mabbay at openjdk.org Thu Dec 18 21:23:39 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Thu, 18 Dec 2025 21:23:39 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v5] In-Reply-To: References: Message-ID: <5YG5ZIU75H8d0uXqDLfAYtVI7lRQwzIrxNHmEdyXXvE=.b9c7100f-046c-41c0-b982-1ca2eff33130@github.com> > Write test to make sure java version check we do before building models is working. > There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Assert that calling Op.ofMethod multiple times will throw the same exception ------------- Changes: - all: https://git.openjdk.org/babylon/pull/748/files - new: https://git.openjdk.org/babylon/pull/748/files/680ce7aa..3536e587 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=748&range=04 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=748&range=03-04 Stats: 5 lines in 1 file changed: 4 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/748.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/748/head:pull/748 PR: https://git.openjdk.org/babylon/pull/748 From ntv at openjdk.org Thu Dec 18 21:26:01 2025 From: ntv at openjdk.org (Nadeesh TV) Date: Thu, 18 Dec 2025 21:26:01 GMT Subject: [code-reflection] RFR: Fix some typos and doc improvement Message-ID: Fix typos and made some minor improvement in the build doc. ------------- Commit messages: - Fix some typos and doc improvement Changes: https://git.openjdk.org/babylon/pull/766/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=766&range=00 Stats: 24 lines in 7 files changed: 16 ins; 0 del; 8 mod Patch: https://git.openjdk.org/babylon/pull/766.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/766/head:pull/766 PR: https://git.openjdk.org/babylon/pull/766 From psandoz at openjdk.org Thu Dec 18 22:35:46 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 18 Dec 2025 22:35:46 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v5] In-Reply-To: <5YG5ZIU75H8d0uXqDLfAYtVI7lRQwzIrxNHmEdyXXvE=.b9c7100f-046c-41c0-b982-1ca2eff33130@github.com> References: <5YG5ZIU75H8d0uXqDLfAYtVI7lRQwzIrxNHmEdyXXvE=.b9c7100f-046c-41c0-b982-1ca2eff33130@github.com> Message-ID: <91Vhf1f8S3CcbNR5_oZifE-ANgFYictAxZD54E17SYY=.0a389ead-7ae3-4203-904c-5188903b6465@github.com> On Thu, 18 Dec 2025 21:23:39 GMT, Mourad Abbay wrote: >> Write test to make sure java version check we do before building models is working. >> There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Assert that calling Op.ofMethod multiple times will throw the same exception test/jdk/java/lang/reflect/code/writer/TestJavaVersionCheckerForMethods.java line 35: > 33: void test() throws ReflectiveOperationException, IOException { > 34: Method m = this.getClass().getDeclaredMethod("max", int.class, int.class); > 35: int n = new Random().nextInt(2, 10); There's no need to be random, just do it twice. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/748#discussion_r2632855354 From mabbay at openjdk.org Fri Dec 19 01:38:11 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 01:38:11 GMT Subject: git: openjdk/babylon: code-reflection: Test java version check we do in op building methods Message-ID: Changeset: 95c3b79f Branch: code-reflection Author: Mourad Abbay Date: 2025-12-19 01:37:14 +0000 URL: https://git.openjdk.org/babylon/commit/95c3b79f816af9ab7984912afd7118cdf647124d Test java version check we do in op building methods Reviewed-by: mcimadamore, psandoz ! src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java + test/jdk/java/lang/reflect/code/writer/TestJavaVersionCheckerForLambdas.java + test/jdk/java/lang/reflect/code/writer/TestJavaVersionCheckerForMethods.java From mabbay at openjdk.org Fri Dec 19 01:41:07 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 01:41:07 GMT Subject: [code-reflection] RFR: Test java version check we do in op building methods [v6] In-Reply-To: References: Message-ID: > Write test to make sure java version check we do before building models is working. > There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Apply suggestions ------------- Changes: - all: https://git.openjdk.org/babylon/pull/748/files - new: https://git.openjdk.org/babylon/pull/748/files/3536e587..977c5816 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=748&range=05 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=748&range=04-05 Stats: 4 lines in 1 file changed: 0 ins; 1 del; 3 mod Patch: https://git.openjdk.org/babylon/pull/748.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/748/head:pull/748 PR: https://git.openjdk.org/babylon/pull/748 From mabbay at openjdk.org Fri Dec 19 01:41:09 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 01:41:09 GMT Subject: [code-reflection] Integrated: Test java version check we do in op building methods In-Reply-To: References: Message-ID: <6gEW5rqcoh00fpWhkAjnUaPsVh529AzBCGorH9hoJ8s=.cb5ff3be-787d-4503-9852-3c25c216aabb@github.com> On Fri, 12 Dec 2025 18:54:11 GMT, Mourad Abbay wrote: > Write test to make sure java version check we do before building models is working. > There are other options to do the test, one in particular is passing the java compile time version as option and update the OpBuilder to accept the feature version we test against. This pull request has now been integrated. Changeset: 95c3b79f Author: Mourad Abbay URL: https://git.openjdk.org/babylon/commit/95c3b79f816af9ab7984912afd7118cdf647124d Stats: 134 lines in 3 files changed: 132 ins; 2 del; 0 mod Test java version check we do in op building methods Reviewed-by: mcimadamore, psandoz ------------- PR: https://git.openjdk.org/babylon/pull/748 From jfumero at openjdk.org Fri Dec 19 06:41:23 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Fri, 19 Dec 2025 06:41:23 GMT Subject: [code-reflection] RFR: Fix some typos and doc improvement In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 21:19:51 GMT, Nadeesh TV wrote: > Fix typos and made some minor improvement in the build doc. Marked as reviewed by jfumero (Reviewer). ------------- PR Review: https://git.openjdk.org/babylon/pull/766#pullrequestreview-3597115664 From duke at openjdk.org Fri Dec 19 06:50:21 2025 From: duke at openjdk.org (duke) Date: Fri, 19 Dec 2025 06:50:21 GMT Subject: [code-reflection] RFR: Add HATPtrOps to array view In-Reply-To: References: Message-ID: <__iRWvFqicHNepjxYOnnw9OpycaPGAs_PEjfqQW8Fq0=.808f6b04-f5ec-4810-9354-1d92d1ce9df8@github.com> On Thu, 18 Dec 2025 20:42:08 GMT, Ruby Chen wrote: > Add four new HATPtrOps to support array views. > > Also update array view tests and add a new test to check for correct memory copies for a write only buffer. > > Minor change in BufferTagger to change access types into bytes. @rbrchen Your change (at version b0fd7d8ddf597e2bd5d66affb315f47d1b546591) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/765#issuecomment-3673805341 From asotona at openjdk.org Fri Dec 19 08:05:42 2025 From: asotona at openjdk.org (Adam Sotona) Date: Fri, 19 Dec 2025 08:05:42 GMT Subject: [code-reflection] RFR: Unreflect tests [v3] In-Reply-To: References: Message-ID: <-mCyxbw4mUujDylCZvlyDr7fZ6fLM4r-W3vxNw8gT2k=.5afcd133-4ed0-476e-9676-87e951d13e30@github.com> On Thu, 18 Dec 2025 14:44:14 GMT, Adam Sotona wrote: >> This PR implement `Unreflect` test tool and re-runs tests in the unreflected form. >> >> `TestSwitchExpressionOp` and `TestSwitchStatementOp` yet to be temporary excluded as failing (see [JDK-8373573](https://bugs.openjdk.org/browse/JDK-8373573)). > > Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: > > - obsolete debug print > > - new line Good points. Yes, some tests require closer look and `bytecode` test package become mostly obsolete, I'll clean it. And reflectable lambdas should be covered by unreflected round of tests as well. ------------- PR Comment: https://git.openjdk.org/babylon/pull/762#issuecomment-3674001843 From jfumero at openjdk.org Fri Dec 19 08:12:11 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Fri, 19 Dec 2025 08:12:11 GMT Subject: [code-reflection] RFR: Add HATPtrOps to array view In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 20:42:08 GMT, Ruby Chen wrote: > Add four new HATPtrOps to support array views. > > Also update array view tests and add a new test to check for correct memory copies for a write only buffer. > > Minor change in BufferTagger to change access types into bytes. Thanks @rbrchen . I added some comments. All tests passing from my side. hat/core/src/main/java/hat/buffer/BF16Array.java line 51: > 49: } > 50: > 51: default BF16Impl[] arrayview() {return null;} Rename to `arrayView` for consistency with the other types. hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java line 535: > 533: } > 534: > 535: T ptrAccess(ScopedCodeBuilderContext builderContext, HATPtrOp hatPtrOp) { method private to this class? Consider adding `private` hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java line 571: > 569: return switch (op) { > 570: case CoreOp.VarOp varOp -> varOp.varName(); > 571: case HATLocalVarOp hatLocalVarOp -> hatLocalVarOp.varName(); Consider using the base class for both Local and Private `HATMemoryOp` and call the varName method. So the switch will be simplified. hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java line 226: > 224: record Node(T value, List> edges) { > 225: ArrayAccessInfo getInfo(Map replaced) { > 226: List> wl = new ArrayList<>(); what `wl` stands for? hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java line 237: > 235: if (res.op() instanceof JavaOp.ArrayAccessOp || res.op() instanceof JavaOp.ArrayLengthOp) { > 236: buffer = res; > 237: indices.addFirst(res.op() instanceof JavaOp.ArrayAccessOp ? ((Op.Result) res.op().operands().get(1)) : ((Op.Result) res.op().operands().get(0))); Consider adding a private method that returns the right operand. private Op.Result getOperand(...) { return res.op() instanceof JavaOp.ArrayAccessOp ? ((Op.Result) res.op().operands().get(1)) : ((Op.Result) res.op().operands().get(0)); } ``` ------------- Changes requested by jfumero (Reviewer). PR Review: https://git.openjdk.org/babylon/pull/765#pullrequestreview-3597382361 PR Review Comment: https://git.openjdk.org/babylon/pull/765#discussion_r2634053525 PR Review Comment: https://git.openjdk.org/babylon/pull/765#discussion_r2634074070 PR Review Comment: https://git.openjdk.org/babylon/pull/765#discussion_r2634087399 PR Review Comment: https://git.openjdk.org/babylon/pull/765#discussion_r2634104833 PR Review Comment: https://git.openjdk.org/babylon/pull/765#discussion_r2634115923 From jfumero at openjdk.org Fri Dec 19 08:12:12 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Fri, 19 Dec 2025 08:12:12 GMT Subject: [code-reflection] RFR: Add HATPtrOps to array view In-Reply-To: References: Message-ID: On Fri, 19 Dec 2025 07:44:33 GMT, Juan Fumero wrote: >> Add four new HATPtrOps to support array views. >> >> Also update array view tests and add a new test to check for correct memory copies for a write only buffer. >> >> Minor change in BufferTagger to change access types into bytes. > > hat/core/src/main/java/hat/buffer/BF16Array.java line 51: > >> 49: } >> 50: >> 51: default BF16Impl[] arrayview() {return null;} > > Rename to `arrayView` for consistency with the other types. Do we have any unit-test that uses this view? ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/765#discussion_r2634054389 From duke at openjdk.org Fri Dec 19 08:50:31 2025 From: duke at openjdk.org (duke) Date: Fri, 19 Dec 2025 08:50:31 GMT Subject: [code-reflection] RFR: Fix some typos and doc improvement In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 21:19:51 GMT, Nadeesh TV wrote: > Fix typos and made some minor improvement in the build doc. @deleSerna Your change (at version 3f535c8647d0907c3cc7b7df8cbb63b43ed3a727) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/766#issuecomment-3674141456 From jfumero at openjdk.org Fri Dec 19 10:10:03 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Fri, 19 Dec 2025 10:10:03 GMT Subject: git: openjdk/babylon: code-reflection: Fix some typos and doc improvement Message-ID: Changeset: 3a62cfaa Branch: code-reflection Author: Nadeesh TV Committer: Juan Fumero Date: 2025-12-19 10:07:47 +0000 URL: https://git.openjdk.org/babylon/commit/3a62cfaa2ca7fdf0eb0834fe2e4b27e5800260b6 Fix some typos and doc improvement Reviewed-by: jfumero ! hat/.gitignore ! hat/core/src/main/java/hat/Accelerator.java ! hat/core/src/main/java/hat/ComputeContext.java ! hat/core/src/main/test/hat/SquaresTest.java ! hat/docs/hat-01-02-building-babylon.md ! hat/docs/hat-01-03-building-hat.md ! hat/hat/bld.java From ntv at openjdk.org Fri Dec 19 10:10:40 2025 From: ntv at openjdk.org (Nadeesh TV) Date: Fri, 19 Dec 2025 10:10:40 GMT Subject: [code-reflection] Integrated: Fix some typos and doc improvement In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 21:19:51 GMT, Nadeesh TV wrote: > Fix typos and made some minor improvement in the build doc. This pull request has now been integrated. Changeset: 3a62cfaa Author: Nadeesh TV Committer: Juan Fumero URL: https://git.openjdk.org/babylon/commit/3a62cfaa2ca7fdf0eb0834fe2e4b27e5800260b6 Stats: 24 lines in 7 files changed: 16 ins; 0 del; 8 mod Fix some typos and doc improvement Reviewed-by: jfumero ------------- PR: https://git.openjdk.org/babylon/pull/766 From duke at openjdk.org Fri Dec 19 11:14:59 2025 From: duke at openjdk.org (Ruby Chen) Date: Fri, 19 Dec 2025 11:14:59 GMT Subject: [code-reflection] Integrated: Add HATPtrOps to array view In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 20:42:08 GMT, Ruby Chen wrote: > Add four new HATPtrOps to support array views. > > Also update array view tests and add a new test to check for correct memory copies for a write only buffer. > > Minor change in BufferTagger to change access types into bytes. This pull request has now been integrated. Changeset: f9f58d61 Author: Ruby Chen Committer: Gary Frost URL: https://git.openjdk.org/babylon/commit/f9f58d612b2491f26a375b7101946332ab818394 Stats: 700 lines in 12 files changed: 474 ins; 159 del; 67 mod Add HATPtrOps to array view ------------- PR: https://git.openjdk.org/babylon/pull/765 From gfrost at openjdk.org Fri Dec 19 11:16:39 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 19 Dec 2025 11:16:39 GMT Subject: git: openjdk/babylon: code-reflection: Add HATPtrOps to array view Message-ID: <15c50e57-8e6b-42c3-88c6-bb639032c9cc@openjdk.org> Changeset: f9f58d61 Branch: code-reflection Author: Ruby Chen Committer: Gary Frost Date: 2025-12-19 11:11:43 +0000 URL: https://git.openjdk.org/babylon/commit/f9f58d612b2491f26a375b7101946332ab818394 Add HATPtrOps to array view ! hat/core/src/main/java/hat/BufferTagger.java ! hat/core/src/main/java/hat/buffer/BF16Array.java ! hat/core/src/main/java/hat/codebuilders/BabylonKernelOpBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java + hat/core/src/main/java/hat/dialect/HATPtrLengthOp.java + hat/core/src/main/java/hat/dialect/HATPtrLoadOp.java + hat/core/src/main/java/hat/dialect/HATPtrOp.java + hat/core/src/main/java/hat/dialect/HATPtrStoreOp.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java ! hat/tests/src/main/java/hat/test/TestArrayView.java + hat/tests/src/main/java/hat/test/TestWriteOnly.java From gfrost at openjdk.org Fri Dec 19 13:42:17 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 19 Dec 2025 13:42:17 GMT Subject: git: openjdk/babylon: code-reflection: Rationalizing use of MethodHandles.Lookup and Arena passing Message-ID: Changeset: 3fbc5dd3 Branch: code-reflection Author: Gary Frost Date: 2025-12-19 13:40:05 +0000 URL: https://git.openjdk.org/babylon/commit/3fbc5dd3593645cbdf64047c965c42f53694090a Rationalizing use of MethodHandles.Lookup and Arena passing ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java ! hat/backends/ffi/mock/src/main/java/hat/backend/ffi/MockBackend.java ! hat/backends/ffi/mock/src/main/java/hat/backend/ffi/MockDeviceInfo.java ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackendDriver.java ! hat/backends/java/mt/src/main/java/hat/backend/java/JavaMultiThreadedBackend.java ! hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/C99JExtractedBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackendDriver.java ! hat/core/src/main/java/hat/Accelerator.java ! hat/core/src/main/java/hat/ComputeContext.java ! hat/core/src/main/java/hat/backend/Backend.java ! hat/core/src/main/java/hat/backend/BackendAdaptor.java ! hat/core/src/main/java/hat/backend/DebugBackend.java ! hat/core/src/main/java/hat/backend/java/JavaBackend.java ! hat/core/src/main/java/hat/callgraph/ComputeCallGraph.java ! hat/core/src/main/java/hat/callgraph/KernelCallGraph.java ! hat/core/src/main/java/hat/ifacemapper/AbstractSegmentMapper.java ! hat/core/src/main/java/hat/ifacemapper/BoundSchema.java ! hat/core/src/main/java/hat/ifacemapper/BufferAllocator.java ! hat/core/src/main/java/hat/ifacemapper/MapperCache.java ! hat/core/src/main/java/hat/ifacemapper/Schema.java ! hat/core/src/main/java/hat/ifacemapper/SegmentInterfaceMapper.java ! hat/core/src/main/java/hat/ifacemapper/SegmentMapper.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyBarrierPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyMemoryPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyThreadsPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorOpPhase.java ! hat/examples/experiments/src/main/java/experiments/Mesh.java ! hat/examples/experiments/src/main/java/experiments/S08x3ImageTest.java ! hat/examples/experiments/src/main/java/experiments/S32ArrayTest.java ! hat/intellij/backend_ffi_mock.iml ! hat/intellij/backend_java_mt.iml ! hat/intellij/backend_java_seq.iml ! hat/intellij/example_blackscholes.iml ! hat/intellij/example_heal.iml ! hat/intellij/example_life.iml ! hat/intellij/example_mandel.iml ! hat/intellij/example_matmul.iml ! hat/intellij/example_nbody.iml ! hat/intellij/example_squares.iml ! hat/intellij/example_violajones.iml = hat/optkl/src/main/java/optkl/ArenaCarrier.java = hat/optkl/src/main/java/optkl/LookupCarrier.java From gfrost at openjdk.org Fri Dec 19 13:43:16 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 19 Dec 2025 13:43:16 GMT Subject: [code-reflection] Integrated: Rationalizing use of MethodHandles.Lookup and Arena passing Message-ID: We had various strategies for accessing MethodHandle.Lookup's and Arena's This PR defines LookupCarrier and ArenaCarrier interfaces and allows us to often pass XXCarrier or access a XXCarrier to get hold of a valid lookup. More work to do but this cleans up accesses. ------------- Commit messages: - Rationalizing use of MethodHandles.Lookup and Arena passing Changes: https://git.openjdk.org/babylon/pull/767/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=767&range=00 Stats: 294 lines in 49 files changed: 113 ins; 60 del; 121 mod Patch: https://git.openjdk.org/babylon/pull/767.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/767/head:pull/767 PR: https://git.openjdk.org/babylon/pull/767 From gfrost at openjdk.org Fri Dec 19 13:43:17 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 19 Dec 2025 13:43:17 GMT Subject: [code-reflection] Integrated: Rationalizing use of MethodHandles.Lookup and Arena passing In-Reply-To: References: Message-ID: <4H7oEgyU19I_y8WMJ2Z7WjMAjff0rlEDuXdbXz126fU=.e76bbf76-5042-47a0-b6dc-b0e47e5043c2@github.com> On Fri, 19 Dec 2025 13:36:29 GMT, Gary Frost wrote: > We had various strategies for accessing MethodHandle.Lookup's and Arena's > > This PR defines LookupCarrier and ArenaCarrier interfaces and allows us to often pass XXCarrier or access a XXCarrier to get hold of a valid lookup. > > More work to do but this cleans up accesses. This pull request has now been integrated. Changeset: 3fbc5dd3 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/3fbc5dd3593645cbdf64047c965c42f53694090a Stats: 294 lines in 49 files changed: 113 ins; 60 del; 121 mod Rationalizing use of MethodHandles.Lookup and Arena passing ------------- PR: https://git.openjdk.org/babylon/pull/767 From mcimadamore at openjdk.org Fri Dec 19 14:11:47 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 19 Dec 2025 14:11:47 GMT Subject: [code-reflection] RFR: Unreflect tests [v3] In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 18:08:39 GMT, Paul Sandoz wrote: >> Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: >> >> - obsolete debug print >> >> - new line > > This is a very nice approach. There are some tests where reflectable methods are never invoked e.g., `CoreBinaryOpsTest`, which tests the model in the interpreter and explicitly generated bytecode, in this case we arguably should also test direct invocation So i think it may be worth going through and checking as not all tests need to be modified and some might be to ensure larger converage. Further, with this test do we need as many specific bytecode tests? can we simplify or reduce those now? > > Any thoughts on how we might apply the same approach to reflectable lambdas? I guess we can rewrite the invoke dynamic instructions. I was probably thinking along similar lines as @PaulSandoz -- in the compiler we have tests like TreePosTest which looks for _all_ tests, and try to do something with them (in that case, ensure that start/end position of all the AST nodes generated while compiling such tests is accurate). This allows to leave other tests unchanged (e.g. we don't have to manually change the test header of each new test to run the position test -- the position test picks that up automatically, as soon as it is added to the compiler test tree). I think a similar approach would be beneficial here also. Other than that -- great work! ------------- PR Comment: https://git.openjdk.org/babylon/pull/762#issuecomment-3675215975 From gfrost at openjdk.org Fri Dec 19 14:31:57 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 19 Dec 2025 14:31:57 GMT Subject: git: openjdk/babylon: code-reflection: Moved the ifacemapper out of HAT core to optlk Message-ID: Changeset: ead504a5 Branch: code-reflection Author: Gary Frost Date: 2025-12-19 14:27:41 +0000 URL: https://git.openjdk.org/babylon/commit/ead504a521ea47b95bda09788ec8d113c817a198 Moved the ifacemapper out of HAT core to optlk ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/PTXHATKernelBuilder.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackendDriver.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/C99JExtractedBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/core/src/main/java/hat/Accelerator.java ! hat/core/src/main/java/hat/BufferTagger.java ! hat/core/src/main/java/hat/ComputeContext.java ! hat/core/src/main/java/hat/backend/Backend.java ! hat/core/src/main/java/hat/backend/BackendAdaptor.java ! hat/core/src/main/java/hat/backend/java/JavaBackend.java ! hat/core/src/main/java/hat/buffer/ArgArray.java ! hat/core/src/main/java/hat/buffer/BF16Array.java ! hat/core/src/main/java/hat/buffer/F16Array.java ! hat/core/src/main/java/hat/buffer/F32Array.java ! hat/core/src/main/java/hat/buffer/F32Array2D.java ! hat/core/src/main/java/hat/buffer/F32ArrayPadded.java ! hat/core/src/main/java/hat/buffer/ImageIfaceBuffer.java ! hat/core/src/main/java/hat/buffer/KernelBufferContext.java ! hat/core/src/main/java/hat/buffer/S08x3RGBImage.java ! hat/core/src/main/java/hat/buffer/S32Array.java ! hat/core/src/main/java/hat/buffer/S32Array2D.java ! hat/core/src/main/java/hat/buffer/S32RGBAImage.java ! hat/core/src/main/java/hat/buffer/U16GreyImage.java ! hat/core/src/main/java/hat/callgraph/ComputeCallGraph.java ! hat/core/src/main/java/hat/callgraph/KernelCallGraph.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/dialect/HATPtrOp.java - hat/core/src/main/java/hat/ifacemapper/SchemaBuilder.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java ! hat/core/src/main/java/hat/phases/HATFinalDetectionPhase.java ! hat/examples/blackscholes/src/main/java/blackscholes/Main.java ! hat/examples/experiments/src/main/java/experiments/LayoutExample.java ! hat/examples/experiments/src/main/java/experiments/LocalArray.java ! hat/examples/experiments/src/main/java/experiments/LocalIds.java ! hat/examples/experiments/src/main/java/experiments/Mesh.java ! hat/examples/experiments/src/main/java/experiments/MinBufferTest.java ! hat/examples/experiments/src/main/java/experiments/PrefixSum.java ! hat/examples/experiments/src/main/java/experiments/QuotedArrayArg.java ! hat/examples/experiments/src/main/java/experiments/QuotedConstantArgs.java ! hat/examples/experiments/src/main/java/experiments/Reduction.java ! hat/examples/experiments/src/main/java/experiments/S08x3ImageTest.java ! hat/examples/experiments/src/main/java/experiments/S32ArrayTest.java ! hat/examples/experiments/src/main/java/experiments/spirv/MatrixMultiply.java ! hat/examples/heal/src/main/java/heal/Box.java ! hat/examples/heal/src/main/java/heal/ComputeHeal.java ! hat/examples/heal/src/main/java/heal/XYRGBList.java ! hat/examples/life/src/main/java/life/Main.java ! hat/examples/life/src/main/java/life/Viewer.java ! hat/examples/mandel/src/main/java/mandel/Main.java ! hat/examples/mandel/src/main/java/mandel/Viewer.java ! hat/examples/matmul/src/main/java/matmul/Main.java ! hat/examples/nbody/src/main/java/nbody/Universe.java ! hat/examples/nbody/src/main/java/nbody/opencl/OpenCLNBodyGLWindow.java ! hat/examples/squares/src/main/java/squares/Main.java ! hat/examples/violajones/src/main/java/violajones/ViolaJonesCoreCompute.java ! hat/examples/violajones/src/main/java/violajones/ifaces/Cascade.java ! hat/examples/violajones/src/main/java/violajones/ifaces/ResultTable.java ! hat/examples/violajones/src/main/java/violajones/ifaces/ScaleTable.java ! hat/intellij/wrap_opencl.iml + hat/optkl/src/main/java/optkl/CommonCarrier.java = hat/optkl/src/main/java/optkl/annotations/After.java = hat/optkl/src/main/java/optkl/annotations/Align.java = hat/optkl/src/main/java/optkl/annotations/Kernel.java = hat/optkl/src/main/java/optkl/annotations/Order.java = hat/optkl/src/main/java/optkl/annotations/Pad.java = hat/optkl/src/main/java/optkl/annotations/Preformatted.java = hat/optkl/src/main/java/optkl/annotations/ProvidesDimFor.java = hat/optkl/src/main/java/optkl/annotations/TypeDef.java = hat/optkl/src/main/java/optkl/ifacemapper/AbstractSegmentMapper.java = hat/optkl/src/main/java/optkl/ifacemapper/BoundSchema.java = hat/optkl/src/main/java/optkl/ifacemapper/Buffer.java = hat/optkl/src/main/java/optkl/ifacemapper/BufferAllocator.java = hat/optkl/src/main/java/optkl/ifacemapper/BufferState.java = hat/optkl/src/main/java/optkl/ifacemapper/BufferTracker.java = hat/optkl/src/main/java/optkl/ifacemapper/ByteCodeGenerator.java = hat/optkl/src/main/java/optkl/ifacemapper/MappableIface.java = hat/optkl/src/main/java/optkl/ifacemapper/MapperCache.java = hat/optkl/src/main/java/optkl/ifacemapper/MapperUtil.java = hat/optkl/src/main/java/optkl/ifacemapper/Schema.java + hat/optkl/src/main/java/optkl/ifacemapper/SchemaBuilder.java = hat/optkl/src/main/java/optkl/ifacemapper/SegmentInterfaceMapper.java = hat/optkl/src/main/java/optkl/ifacemapper/SegmentMapper.java = hat/optkl/src/main/java/optkl/ifacemapper/accessor/AccessorInfo.java = hat/optkl/src/main/java/optkl/ifacemapper/accessor/Accessors.java = hat/optkl/src/main/java/optkl/ifacemapper/accessor/ArrayInfo.java = hat/optkl/src/main/java/optkl/ifacemapper/accessor/Cardinality.java = hat/optkl/src/main/java/optkl/ifacemapper/accessor/LayoutInfo.java = hat/optkl/src/main/java/optkl/ifacemapper/accessor/ScalarInfo.java = hat/optkl/src/main/java/optkl/ifacemapper/accessor/ValueType.java = hat/optkl/src/main/java/optkl/ifacemapper/component/Util.java ! hat/tests/src/main/java/hat/test/TestArrayView.java ! hat/tests/src/main/java/hat/test/TestArrays.java ! hat/tests/src/main/java/hat/test/TestBFloat16Type.java ! hat/tests/src/main/java/hat/test/TestBlackscholes.java ! hat/tests/src/main/java/hat/test/TestConstants.java ! hat/tests/src/main/java/hat/test/TestF16Type.java ! hat/tests/src/main/java/hat/test/TestFloat2.java ! hat/tests/src/main/java/hat/test/TestLocal.java ! hat/tests/src/main/java/hat/test/TestMandel.java ! hat/tests/src/main/java/hat/test/TestMatMul.java ! hat/tests/src/main/java/hat/test/TestNbody.java ! hat/tests/src/main/java/hat/test/TestParenthesis.java ! hat/tests/src/main/java/hat/test/TestPrivate.java ! hat/tests/src/main/java/hat/test/TestReductions.java ! hat/tests/src/main/java/hat/test/TestVectorArrayView.java ! hat/tests/src/main/java/hat/test/TestVectorTypes.java ! hat/tests/src/main/java/hat/test/TestWriteOnly.java ! hat/tools/src/main/java/hat/tools/text/TestJavaHATCodeBuilder.java ! hat/wraps/opencl/src/main/java/wrap/opencl/CLPlatform.java From gfrost at openjdk.org Fri Dec 19 14:32:29 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 19 Dec 2025 14:32:29 GMT Subject: [code-reflection] Integrated: Moved the ifacemapper out of HAT core to optlk Message-ID: We can now use iface mapper outside of HAT. This allows us to write non HAT specific tests. (just leaning on optkl.jar) and allow others to experiment with iface mapper. ------------- Commit messages: - Moved the ifacemapper out of HAT core to optlk Changes: https://git.openjdk.org/babylon/pull/768/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=768&range=00 Stats: 524 lines in 113 files changed: 148 ins; 116 del; 260 mod Patch: https://git.openjdk.org/babylon/pull/768.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/768/head:pull/768 PR: https://git.openjdk.org/babylon/pull/768 From gfrost at openjdk.org Fri Dec 19 14:32:29 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 19 Dec 2025 14:32:29 GMT Subject: [code-reflection] Integrated: Moved the ifacemapper out of HAT core to optlk In-Reply-To: References: Message-ID: <2A8keU1BX47kxDLuy-lu7Ea-7E7EAQrl9ZYKP9wJRRk=.4e0354ec-77dc-491e-ad6f-5b8a50b5253e@github.com> On Fri, 19 Dec 2025 14:22:59 GMT, Gary Frost wrote: > We can now use iface mapper outside of HAT. > > This allows us to write non HAT specific tests. (just leaning on optkl.jar) and allow others to experiment with iface mapper. This pull request has now been integrated. Changeset: ead504a5 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/ead504a521ea47b95bda09788ec8d113c817a198 Stats: 524 lines in 113 files changed: 148 ins; 116 del; 260 mod Moved the ifacemapper out of HAT core to optlk ------------- PR: https://git.openjdk.org/babylon/pull/768 From mabbay at openjdk.org Fri Dec 19 16:09:05 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 16:09:05 GMT Subject: [code-reflection] RFR: Lazily invoke lambda op building method Message-ID: Validation introduced in #738 is causing reflectable lambda creation to fail with an `InternalError`. The reason for this is that we are invoking lambda op building method in the lambda class static initializer, when lambda op building method throws UOE, it causes lambda creation to fail with `InternalError`. What we want is `Op.ofQuotable` to fail but not lambda instantiation. To adress this, we now lazily invoke lambda op building method and as result we lazily compute the `Quoted` instance, while sharing the lambda model across instances of the same lambda class. ------------- Commit messages: - Test that calls to Op.ofQuotable produce the same instance - Move tests to the right directory - Lazily invoke lambda op building method Changes: https://git.openjdk.org/babylon/pull/769/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=769&range=00 Stats: 421 lines in 8 files changed: 235 ins; 176 del; 10 mod Patch: https://git.openjdk.org/babylon/pull/769.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/769/head:pull/769 PR: https://git.openjdk.org/babylon/pull/769 From asotona at openjdk.org Fri Dec 19 17:14:36 2025 From: asotona at openjdk.org (Adam Sotona) Date: Fri, 19 Dec 2025 17:14:36 GMT Subject: [code-reflection] RFR: Unreflect tests [v3] In-Reply-To: References: Message-ID: On Thu, 18 Dec 2025 14:44:14 GMT, Adam Sotona wrote: >> This PR implement `Unreflect` test tool and re-runs tests in the unreflected form. >> >> `TestSwitchExpressionOp` and `TestSwitchStatementOp` yet to be temporary excluded as failing (see [JDK-8373573](https://bugs.openjdk.org/browse/JDK-8373573)). > > Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: > > - obsolete debug print > > - new line If I understand it correctly `TreePosTest` is trying to compile the tests. However here we are re-executing the tests with unreflected classes. I assume doing it globally on a tree of tests (without alteration of the test headers) would require some kind of `jtreg` runtime plugin or patch. ------------- PR Comment: https://git.openjdk.org/babylon/pull/762#issuecomment-3675875679 From gfrost at openjdk.org Fri Dec 19 17:34:26 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 19 Dec 2025 17:34:26 GMT Subject: [code-reflection] Integrated: Hat cleanup phases Message-ID: <--5Ar_KU6QM3X1LYOn37H_qlCxy9eRsY4JDy3W9UwRI=.0466df79-e387-4fb4-9c39-7bcbe8d0a71d@github.com> Converted a few Phases to records. Removed some duplicate code. Leaned op OpTK helpers. ------------- Commit messages: - Phase transformation housekeeping - Phase transformation housekeeping Changes: https://git.openjdk.org/babylon/pull/770/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=770&range=00 Stats: 359 lines in 21 files changed: 153 ins; 169 del; 37 mod Patch: https://git.openjdk.org/babylon/pull/770.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/770/head:pull/770 PR: https://git.openjdk.org/babylon/pull/770 From gfrost at openjdk.org Fri Dec 19 17:34:27 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 19 Dec 2025 17:34:27 GMT Subject: [code-reflection] Integrated: Hat cleanup phases In-Reply-To: <--5Ar_KU6QM3X1LYOn37H_qlCxy9eRsY4JDy3W9UwRI=.0466df79-e387-4fb4-9c39-7bcbe8d0a71d@github.com> References: <--5Ar_KU6QM3X1LYOn37H_qlCxy9eRsY4JDy3W9UwRI=.0466df79-e387-4fb4-9c39-7bcbe8d0a71d@github.com> Message-ID: On Fri, 19 Dec 2025 17:28:00 GMT, Gary Frost wrote: > Converted a few Phases to records. > > Removed some duplicate code. > > Leaned op OpTK helpers. This pull request has now been integrated. Changeset: 520ee2b6 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/520ee2b6a51277d7f53e4a25d743fa0c9f52f56a Stats: 359 lines in 21 files changed: 153 ins; 169 del; 37 mod Hat cleanup phases ------------- PR: https://git.openjdk.org/babylon/pull/770 From gfrost at openjdk.org Fri Dec 19 17:36:21 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 19 Dec 2025 17:36:21 GMT Subject: git: openjdk/babylon: code-reflection: Hat cleanup phases Message-ID: <892fa8d6-2124-466e-849e-ab013b52de89@openjdk.org> Changeset: 520ee2b6 Branch: code-reflection Author: Gary Frost Date: 2025-12-19 17:31:04 +0000 URL: https://git.openjdk.org/babylon/commit/520ee2b6a51277d7f53e4a25d743fa0c9f52f56a Hat cleanup phases ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/core/src/main/java/hat/NDRange.java + hat/core/src/main/java/hat/dialect/BinaryOpEnum.java ! hat/core/src/main/java/hat/dialect/HATF16AddOp.java ! hat/core/src/main/java/hat/dialect/HATF16BinaryOp.java ! hat/core/src/main/java/hat/dialect/HATF16DivOp.java ! hat/core/src/main/java/hat/dialect/HATF16MulOp.java ! hat/core/src/main/java/hat/dialect/HATF16SubOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATLocalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATLocalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATVectorAddOp.java ! hat/core/src/main/java/hat/dialect/HATVectorBinaryOp.java ! hat/core/src/main/java/hat/dialect/HATVectorDivOp.java ! hat/core/src/main/java/hat/dialect/HATVectorMulOp.java ! hat/core/src/main/java/hat/dialect/HATVectorSubOp.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorOpPhase.java - hat/core/src/main/java/hat/phases/HATFinalDetectionPhase.java + hat/core/src/main/java/hat/phases/HATFinalDetector.java From mabbay at openjdk.org Fri Dec 19 20:22:18 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 20:22:18 GMT Subject: [code-reflection] RFR: Fix the bug of pattern variable initialized with conversion Message-ID: Generating code model for code such as: ```@Reflect void m(int i) { if (i instanceof byte b) { } } ``` was causing the below error in the compiler: java.lang.IllegalStateException: Operand of operation jdk.incubator.code.dialect.core.CoreOp$VarOp at 503d687a is not defined in tree: %result at 482bce4f at jdk.incubator.code/jdk.incubator.code.Block.bindOp(Block.java:764) at jdk.incubator.code/jdk.incubator.code.Block.insertOp(Block.java:743) at jdk.incubator.code/jdk.incubator.code.Block$Builder.op(Block.java:697) at jdk.incubator.code/jdk.incubator.code.internal.ReflectMethods$BodyScanner.scanPattern(ReflectMethods.java:1342) ... The cause is that we were adding the op that perform the conversion to the block of the IfOp first body, making the value unreachable to the VarOp of the pattern variable. The fix is from @PaulSandoz. ------------- Commit messages: - Apply the fix Changes: https://git.openjdk.org/babylon/pull/771/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=771&range=00 Stats: 13 lines in 1 file changed: 7 ins; 0 del; 6 mod Patch: https://git.openjdk.org/babylon/pull/771.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/771/head:pull/771 PR: https://git.openjdk.org/babylon/pull/771 From mabbay at openjdk.org Fri Dec 19 20:26:59 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 20:26:59 GMT Subject: [code-reflection] RFR: Fix the bug of pattern variable initialized with conversion [v2] In-Reply-To: References: Message-ID: > Generating code model for code such as: > ```@Reflect > void m(int i) { > if (i instanceof byte b) { > > } > } > ``` > was causing the below error in the compiler: > > java.lang.IllegalStateException: Operand of operation jdk.incubator.code.dialect.core.CoreOp$VarOp at 503d687a is not defined in tree: %result at 482bce4f > at jdk.incubator.code/jdk.incubator.code.Block.bindOp(Block.java:764) > at jdk.incubator.code/jdk.incubator.code.Block.insertOp(Block.java:743) > at jdk.incubator.code/jdk.incubator.code.Block$Builder.op(Block.java:697) > at jdk.incubator.code/jdk.incubator.code.internal.ReflectMethods$BodyScanner.scanPattern(ReflectMethods.java:1342) > ... > > The cause is that we were adding the op that perform the conversion to the block of the IfOp first body, making the value unreachable to the VarOp of the pattern variable. > The fix is from @PaulSandoz. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Add test ------------- Changes: - all: https://git.openjdk.org/babylon/pull/771/files - new: https://git.openjdk.org/babylon/pull/771/files/e1b8f736..171a5627 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=771&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=771&range=00-01 Stats: 35 lines in 1 file changed: 35 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/771.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/771/head:pull/771 PR: https://git.openjdk.org/babylon/pull/771 From psandoz at openjdk.org Fri Dec 19 20:29:33 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 19 Dec 2025 20:29:33 GMT Subject: [code-reflection] RFR: ModuleOp generation from LambdaOp and FuncOp [v9] In-Reply-To: References: Message-ID: On Sun, 14 Dec 2025 04:58:13 GMT, Ruby Chen wrote: >> Add support for generating a ModuleOp from either a LambdaOp or a FuncOp. The given LambdaOp will be converted into the root FuncOp, and the given FuncOp will be assigned as the root FuncOp. >> >> For `CoreOp.ModuleOp.ofLambdaOp()`, a unique name for the new root FuncOp must be passed as a parameter. > > Ruby Chen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 14 additional commits since the last revision: > > - Suggested changes > - Merge branch 'openjdk:code-reflection' into module-op-support > - fixes > - Merge branch 'openjdk:code-reflection' into module-op-support > - fixed tests > - Merge branch 'openjdk:code-reflection' into module-op-support > - Add tests > - Merge branch 'openjdk:code-reflection' into module-op-support > - removing commented code > - Suggested changes > - ... and 4 more: https://git.openjdk.org/babylon/compare/88f72e8c...630cb9d0 This looks good. I think we can iterate in a subsequent PR on the tests, using a similar approach to comparing actual model against an expected textual model. ------------- Marked as reviewed by psandoz (Lead). PR Review: https://git.openjdk.org/babylon/pull/691#pullrequestreview-3599995807 From duke at openjdk.org Fri Dec 19 20:33:30 2025 From: duke at openjdk.org (Ruby Chen) Date: Fri, 19 Dec 2025 20:33:30 GMT Subject: [code-reflection] RFR: ModuleOp generation from LambdaOp and FuncOp [v9] In-Reply-To: References: Message-ID: On Sun, 14 Dec 2025 04:58:13 GMT, Ruby Chen wrote: >> Add support for generating a ModuleOp from either a LambdaOp or a FuncOp. The given LambdaOp will be converted into the root FuncOp, and the given FuncOp will be assigned as the root FuncOp. >> >> For `CoreOp.ModuleOp.ofLambdaOp()`, a unique name for the new root FuncOp must be passed as a parameter. > > Ruby Chen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 14 additional commits since the last revision: > > - Suggested changes > - Merge branch 'openjdk:code-reflection' into module-op-support > - fixes > - Merge branch 'openjdk:code-reflection' into module-op-support > - fixed tests > - Merge branch 'openjdk:code-reflection' into module-op-support > - Add tests > - Merge branch 'openjdk:code-reflection' into module-op-support > - removing commented code > - Suggested changes > - ... and 4 more: https://git.openjdk.org/babylon/compare/8278d491...630cb9d0 That sounds good; thanks for reviewing the PR! ------------- PR Comment: https://git.openjdk.org/babylon/pull/691#issuecomment-3676495188 From duke at openjdk.org Fri Dec 19 20:33:30 2025 From: duke at openjdk.org (duke) Date: Fri, 19 Dec 2025 20:33:30 GMT Subject: [code-reflection] RFR: ModuleOp generation from LambdaOp and FuncOp [v9] In-Reply-To: References: Message-ID: On Sun, 14 Dec 2025 04:58:13 GMT, Ruby Chen wrote: >> Add support for generating a ModuleOp from either a LambdaOp or a FuncOp. The given LambdaOp will be converted into the root FuncOp, and the given FuncOp will be assigned as the root FuncOp. >> >> For `CoreOp.ModuleOp.ofLambdaOp()`, a unique name for the new root FuncOp must be passed as a parameter. > > Ruby Chen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 14 additional commits since the last revision: > > - Suggested changes > - Merge branch 'openjdk:code-reflection' into module-op-support > - fixes > - Merge branch 'openjdk:code-reflection' into module-op-support > - fixed tests > - Merge branch 'openjdk:code-reflection' into module-op-support > - Add tests > - Merge branch 'openjdk:code-reflection' into module-op-support > - removing commented code > - Suggested changes > - ... and 4 more: https://git.openjdk.org/babylon/compare/8278d491...630cb9d0 @rbrchen Your change (at version 630cb9d0d87115511cb138cf119ef1cc996c5503) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/691#issuecomment-3676501347 From mabbay at openjdk.org Fri Dec 19 20:54:30 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 20:54:30 GMT Subject: [code-reflection] RFR: Fix lowering type pattern Message-ID: <4tU4lVfEUUPcRGKM8GY7dh9PHzN5yn941PzgpXvkD9Y=.e283bea4-dd11-4aee-8fd2-2786e997fd8d@github.com> The lowering of TypePattern was performing unnecessary check by invoking inexistent method on ExactConversionSupport e.g. `isIntToIntExact. ------------- Commit messages: - Test we don't perform check for primitive identity conversion - Fix the logic of isNarrowingPrimitiveConversion Changes: https://git.openjdk.org/babylon/pull/772/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=772&range=00 Stats: 3 lines in 2 files changed: 2 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/772.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/772/head:pull/772 PR: https://git.openjdk.org/babylon/pull/772 From psandoz at openjdk.org Fri Dec 19 21:04:07 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 19 Dec 2025 21:04:07 GMT Subject: [code-reflection] RFR: Lazily invoke lambda op building method In-Reply-To: References: Message-ID: On Fri, 19 Dec 2025 16:02:42 GMT, Mourad Abbay wrote: > Validation introduced in #738 is causing reflectable lambda creation to fail with an `InternalError`. The reason for this is that we are invoking lambda op building method in the lambda class static initializer, when lambda op building method throws UOE, it causes lambda creation to fail with `InternalError`. What we want is `Op.ofQuotable` to fail but not lambda instantiation. To adress this, we now lazily invoke lambda op building method and as result we lazily compute the `Quoted` instance, while sharing the lambda model across instances of the same lambda class. src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 497: > 495: > 496: /** > 497: * Generate method #__internal_quoted() Inside the method can you document the representative Java code for "getQuoted" and "getModel"? src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 518: > 516: .getfield(lambdaClassEntry.asSymbol(), QUOTED_FIELD_NAME, reflectableLambdaInfo.quotedClass()) > 517: .ifnonnull(nonNull) > 518: .aload(0);// will be used by putfield to store the quoted instance See if using `cob.ifThen` makes the code clearer. src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 548: > 546: .aload(0) > 547: .getfield(lambdaClassEntry.asSymbol(), QUOTED_FIELD_NAME, reflectableLambdaInfo.quotedClass()) > 548: .areturn(); You are loading the field twice. It seems clearer to use a local variable as in: T v = a; if (v == null) { v = a = ...; } return v; src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 553: > 551: > 552: clb.withMethod("getModel", MethodTypeDesc.of(reflectableLambdaInfo.funcOpClass()), > 553: ACC_PRIVATE + ACC_STATIC + ACC_SYNCHRONIZED, This method does not need to be synchronized since it is only called by `getQuoted` which is synchronized. src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 558: > 556: public void accept(CodeBuilder cob) { > 557: Label nonNull = cob.newLabel(); > 558: cob.getstatic(lambdaClassEntry.asSymbol(), MODEL_FIELD_NAME, reflectableLambdaInfo.funcOpClass()) Similar comment as above regarding loading the field twice. test/jdk/java/lang/reflect/code/TestLambdaModelUnique.java line 22: > 20: * @run junit TestLambdaModelUnique > 21: */ > 22: public class TestLambdaModelUnique { Maybe rename to `TestOpOfQuotable`? test/jdk/java/lang/reflect/code/TestMethodModelUnique.java line 17: > 15: * @run junit TestMethodModelUnique > 16: */ > 17: public class TestMethodModelUnique { Maybe rename to `TestOpOfMethod`? test/jdk/java/lang/reflect/code/TestQuotedUnique.java line 17: > 15: * @run junit TestQuotedUnique > 16: */ > 17: public class TestQuotedUnique { Can we merge with `TestLambdaModelUnique` that is renamed? as it is not clear it is doing anything different. test/jdk/java/lang/reflect/code/TestQuotedUnique.java line 32: > 30: int j = 8; > 31: IntUnaryOperator q = (@Reflect IntUnaryOperator) i -> i * 2 + j; > 32: List quotedObjects = IntStream.range(1, 3).parallel().mapToObj(_ -> Op.ofQuotable(q).get()).toList(); We need to think more carefully about this approach. I think we need N threads in proportion to the runtime threads all executing and waiting on a count down latch so all are trigger to call `Op.ofQuotable(q)` at the roughly the same time and all threads should produce the same result, returning exactly the same object or throwing UOE. Then run that process in a loop for say 100 iterations. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636223938 PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636235926 PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636263524 PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636241384 PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636268132 PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636276971 PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636276075 PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636275280 PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636292470 From psandoz at openjdk.org Fri Dec 19 21:53:29 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 19 Dec 2025 21:53:29 GMT Subject: [code-reflection] RFR: Fix lowering type pattern In-Reply-To: <4tU4lVfEUUPcRGKM8GY7dh9PHzN5yn941PzgpXvkD9Y=.e283bea4-dd11-4aee-8fd2-2786e997fd8d@github.com> References: <4tU4lVfEUUPcRGKM8GY7dh9PHzN5yn941PzgpXvkD9Y=.e283bea4-dd11-4aee-8fd2-2786e997fd8d@github.com> Message-ID: On Fri, 19 Dec 2025 20:47:35 GMT, Mourad Abbay wrote: > The lowering of TypePattern was performing unnecessary check by invoking inexistent method on ExactConversionSupport e.g. `isIntToIntExact. src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java line 4937: > 4935: ); > 4936: private static boolean isNarrowingPrimitiveConv(PrimitiveType s, PrimitiveType t) { > 4937: return narrowingOrder.get(t) <= narrowingOrder.get(s) && !s.equals(t); // need to be strict, to not consider int -> int as narrowing Can you replace with `narrowingOrder.get(t) < narrowingOrder.get(s) || !s.equals(t)`? ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/772#discussion_r2636393597 From psandoz at openjdk.org Fri Dec 19 21:58:45 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 19 Dec 2025 21:58:45 GMT Subject: git: openjdk/babylon: code-reflection: ModuleOp generation from LambdaOp and FuncOp Message-ID: <9798b384-90a7-44fa-ad8b-6960340ae62f@openjdk.org> Changeset: 4fa1d641 Branch: code-reflection Author: Ruby Chen Committer: Paul Sandoz Date: 2025-12-19 21:57:46 +0000 URL: https://git.openjdk.org/babylon/commit/4fa1d641e9393edbd815655d0e2965a3351e4065 ModuleOp generation from LambdaOp and FuncOp Reviewed-by: psandoz ! src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/core/CoreOp.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java ! test/jdk/java/lang/reflect/code/TestLambdaOps.java + test/jdk/java/lang/reflect/code/TestModuleOp.java From psandoz at openjdk.org Fri Dec 19 21:59:50 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 19 Dec 2025 21:59:50 GMT Subject: [code-reflection] RFR: Fix the bug of pattern variable initialized with conversion [v2] In-Reply-To: References: Message-ID: On Fri, 19 Dec 2025 20:26:59 GMT, Mourad Abbay wrote: >> Generating code model for code such as: >> ```@Reflect >> void m(int i) { >> if (i instanceof byte b) { >> >> } >> } >> ``` >> was causing the below error in the compiler: >> >> java.lang.IllegalStateException: Operand of operation jdk.incubator.code.dialect.core.CoreOp$VarOp at 503d687a is not defined in tree: %result at 482bce4f >> at jdk.incubator.code/jdk.incubator.code.Block.bindOp(Block.java:764) >> at jdk.incubator.code/jdk.incubator.code.Block.insertOp(Block.java:743) >> at jdk.incubator.code/jdk.incubator.code.Block$Builder.op(Block.java:697) >> at jdk.incubator.code/jdk.incubator.code.internal.ReflectMethods$BodyScanner.scanPattern(ReflectMethods.java:1342) >> ... >> >> The cause is that we were adding the op that perform the conversion to the block of the IfOp first body, making the value unreachable to the VarOp of the pattern variable. >> The fix is from @PaulSandoz. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Add test Marked as reviewed by psandoz (Lead). ------------- PR Review: https://git.openjdk.org/babylon/pull/771#pullrequestreview-3600259248 From duke at openjdk.org Fri Dec 19 22:00:56 2025 From: duke at openjdk.org (Ruby Chen) Date: Fri, 19 Dec 2025 22:00:56 GMT Subject: [code-reflection] Integrated: ModuleOp generation from LambdaOp and FuncOp In-Reply-To: References: Message-ID: On Fri, 21 Nov 2025 00:20:24 GMT, Ruby Chen wrote: > Add support for generating a ModuleOp from either a LambdaOp or a FuncOp. The given LambdaOp will be converted into the root FuncOp, and the given FuncOp will be assigned as the root FuncOp. > > For `CoreOp.ModuleOp.ofLambdaOp()`, a unique name for the new root FuncOp must be passed as a parameter. This pull request has now been integrated. Changeset: 4fa1d641 Author: Ruby Chen Committer: Paul Sandoz URL: https://git.openjdk.org/babylon/commit/4fa1d641e9393edbd815655d0e2965a3351e4065 Stats: 298 lines in 4 files changed: 294 ins; 3 del; 1 mod ModuleOp generation from LambdaOp and FuncOp Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/691 From mabbay at openjdk.org Fri Dec 19 22:18:50 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 22:18:50 GMT Subject: [code-reflection] RFR: Lazily invoke lambda op building method [v2] In-Reply-To: References: Message-ID: > Validation introduced in #738 is causing reflectable lambda creation to fail with an `InternalError`. The reason for this is that we are invoking lambda op building method in the lambda class static initializer, when lambda op building method throws UOE, it causes lambda creation to fail with `InternalError`. What we want is `Op.ofQuotable` to fail but not lambda instantiation. To adress this, we now lazily invoke lambda op building method and as result we lazily compute the `Quoted` instance, while sharing the lambda model across instances of the same lambda class. Mourad Abbay has updated the pull request incrementally with three additional commits since the last revision: - Use local variables to reduce number of time we load fields - Use CodeBuilder.IfThen - document the equivalent java code for helpers methods ------------- Changes: - all: https://git.openjdk.org/babylon/pull/769/files - new: https://git.openjdk.org/babylon/pull/769/files/f4524cbd..c092b388 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=769&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=769&range=00-01 Stats: 73 lines in 1 file changed: 25 ins; 6 del; 42 mod Patch: https://git.openjdk.org/babylon/pull/769.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/769/head:pull/769 PR: https://git.openjdk.org/babylon/pull/769 From mabbay at openjdk.org Fri Dec 19 22:18:51 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 22:18:51 GMT Subject: [code-reflection] RFR: Lazily invoke lambda op building method [v2] In-Reply-To: References: Message-ID: On Fri, 19 Dec 2025 20:51:12 GMT, Paul Sandoz wrote: >> Mourad Abbay has updated the pull request incrementally with three additional commits since the last revision: >> >> - Use local variables to reduce number of time we load fields >> - Use CodeBuilder.IfThen >> - document the equivalent java code for helpers methods > > test/jdk/java/lang/reflect/code/TestQuotedUnique.java line 17: > >> 15: * @run junit TestQuotedUnique >> 16: */ >> 17: public class TestQuotedUnique { > > Can we merge with `TestLambdaModelUnique` that is renamed? as it is not clear it is doing anything different. In TestLambdaModelUnique we are concerned with model, in TestQuotedUnique we focus on the Quoted instance. We can merge. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636450791 From mabbay at openjdk.org Fri Dec 19 22:21:21 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 22:21:21 GMT Subject: [code-reflection] RFR: Lazily invoke lambda op building method [v2] In-Reply-To: References: Message-ID: On Fri, 19 Dec 2025 20:37:40 GMT, Paul Sandoz wrote: >> Mourad Abbay has updated the pull request incrementally with three additional commits since the last revision: >> >> - Use local variables to reduce number of time we load fields >> - Use CodeBuilder.IfThen >> - document the equivalent java code for helpers methods > > src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 553: > >> 551: >> 552: clb.withMethod("getModel", MethodTypeDesc.of(reflectableLambdaInfo.funcOpClass()), >> 553: ACC_PRIVATE + ACC_STATIC + ACC_SYNCHRONIZED, > > This method does not need to be synchronized since it is only called by `getQuoted` which is synchronized. The method is static. So two instance of the lambda class can call it in parallel making the value of the field model undefined and we can no longer guarantee that model is shared. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636457630 From mabbay at openjdk.org Fri Dec 19 22:32:08 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 22:32:08 GMT Subject: [code-reflection] RFR: Lazily invoke lambda op building method [v3] In-Reply-To: References: Message-ID: > Validation introduced in #738 is causing reflectable lambda creation to fail with an `InternalError`. The reason for this is that we are invoking lambda op building method in the lambda class static initializer, when lambda op building method throws UOE, it causes lambda creation to fail with `InternalError`. What we want is `Op.ofQuotable` to fail but not lambda instantiation. To adress this, we now lazily invoke lambda op building method and as result we lazily compute the `Quoted` instance, while sharing the lambda model across instances of the same lambda class. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Apply suggestions ------------- Changes: - all: https://git.openjdk.org/babylon/pull/769/files - new: https://git.openjdk.org/babylon/pull/769/files/c092b388..8d829495 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=769&range=02 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=769&range=01-02 Stats: 183 lines in 4 files changed: 79 ins; 102 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/769.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/769/head:pull/769 PR: https://git.openjdk.org/babylon/pull/769 From mabbay at openjdk.org Fri Dec 19 22:32:09 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 22:32:09 GMT Subject: [code-reflection] RFR: Lazily invoke lambda op building method [v3] In-Reply-To: References: Message-ID: On Fri, 19 Dec 2025 20:59:21 GMT, Paul Sandoz wrote: >> Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: >> >> Apply suggestions > > test/jdk/java/lang/reflect/code/TestQuotedUnique.java line 32: > >> 30: int j = 8; >> 31: IntUnaryOperator q = (@Reflect IntUnaryOperator) i -> i * 2 + j; >> 32: List quotedObjects = IntStream.range(1, 3).parallel().mapToObj(_ -> Op.ofQuotable(q).get()).toList(); > > We need to think more carefully about this approach. I think we need N threads in proportion to the runtime threads all executing and waiting on a count down latch so all are trigger to call `Op.ofQuotable(q)` at the roughly the same time and all threads should produce the same result, returning exactly the same object or throwing UOE. Then run that process in a loop for say 100 iterations. So the current approach is not testing in parallel ? ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636477734 From psandoz at openjdk.org Fri Dec 19 22:34:28 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 19 Dec 2025 22:34:28 GMT Subject: [code-reflection] RFR: Lazily invoke lambda op building method [v3] In-Reply-To: References: Message-ID: On Fri, 19 Dec 2025 22:18:29 GMT, Mourad Abbay wrote: >> src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 553: >> >>> 551: >>> 552: clb.withMethod("getModel", MethodTypeDesc.of(reflectableLambdaInfo.funcOpClass()), >>> 553: ACC_PRIVATE + ACC_STATIC + ACC_SYNCHRONIZED, >> >> This method does not need to be synchronized since it is only called by `getQuoted` which is synchronized. > > The method is static. So two instance of the lambda class can call it in parallel making the value of the field model undefined and we can no longer guarantee that model is shared. Doh! yes you are right. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636483438 From mabbay at openjdk.org Fri Dec 19 22:35:17 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 22:35:17 GMT Subject: [code-reflection] RFR: Fix lowering type pattern In-Reply-To: References: <4tU4lVfEUUPcRGKM8GY7dh9PHzN5yn941PzgpXvkD9Y=.e283bea4-dd11-4aee-8fd2-2786e997fd8d@github.com> Message-ID: On Fri, 19 Dec 2025 21:48:07 GMT, Paul Sandoz wrote: >> The lowering of TypePattern was performing unnecessary check by invoking inexistent method on ExactConversionSupport e.g. `isIntToIntExact. > > src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java line 4937: > >> 4935: ); >> 4936: private static boolean isNarrowingPrimitiveConv(PrimitiveType s, PrimitiveType t) { >> 4937: return narrowingOrder.get(t) <= narrowingOrder.get(s) && !s.equals(t); // need to be strict, to not consider int -> int as narrowing > > Can you replace with `narrowingOrder.get(t) < narrowingOrder.get(s) || !s.equals(t)`? this way `byte -> int` will be considered narrowing ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/772#discussion_r2636484249 From mabbay at openjdk.org Fri Dec 19 22:37:01 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 22:37:01 GMT Subject: git: openjdk/babylon: code-reflection: Fix the bug of pattern variable initialized with conversion Message-ID: Changeset: 6973e96d Branch: code-reflection Author: Mourad Abbay Date: 2025-12-19 22:33:10 +0000 URL: https://git.openjdk.org/babylon/commit/6973e96d31d1854a93b9c16ae816d4cf2944f823 Fix the bug of pattern variable initialized with conversion Reviewed-by: psandoz ! src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java ! test/langtools/tools/javac/reflect/PatternsTest.java From mabbay at openjdk.org Fri Dec 19 22:36:54 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 22:36:54 GMT Subject: [code-reflection] Integrated: Fix the bug of pattern variable initialized with conversion In-Reply-To: References: Message-ID: On Fri, 19 Dec 2025 20:15:27 GMT, Mourad Abbay wrote: > Generating code model for code such as: > ```@Reflect > void m(int i) { > if (i instanceof byte b) { > > } > } > ``` > was causing the below error in the compiler: > > java.lang.IllegalStateException: Operand of operation jdk.incubator.code.dialect.core.CoreOp$VarOp at 503d687a is not defined in tree: %result at 482bce4f > at jdk.incubator.code/jdk.incubator.code.Block.bindOp(Block.java:764) > at jdk.incubator.code/jdk.incubator.code.Block.insertOp(Block.java:743) > at jdk.incubator.code/jdk.incubator.code.Block$Builder.op(Block.java:697) > at jdk.incubator.code/jdk.incubator.code.internal.ReflectMethods$BodyScanner.scanPattern(ReflectMethods.java:1342) > ... > > The cause is that we were adding the op that perform the conversion to the block of the IfOp first body, making the value unreachable to the VarOp of the pattern variable. > The fix is from @PaulSandoz. This pull request has now been integrated. Changeset: 6973e96d Author: Mourad Abbay URL: https://git.openjdk.org/babylon/commit/6973e96d31d1854a93b9c16ae816d4cf2944f823 Stats: 48 lines in 2 files changed: 42 ins; 0 del; 6 mod Fix the bug of pattern variable initialized with conversion Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/771 From mabbay at openjdk.org Fri Dec 19 22:41:28 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 19 Dec 2025 22:41:28 GMT Subject: [code-reflection] RFR: Fix lowering type pattern [v2] In-Reply-To: <4tU4lVfEUUPcRGKM8GY7dh9PHzN5yn941PzgpXvkD9Y=.e283bea4-dd11-4aee-8fd2-2786e997fd8d@github.com> References: <4tU4lVfEUUPcRGKM8GY7dh9PHzN5yn941PzgpXvkD9Y=.e283bea4-dd11-4aee-8fd2-2786e997fd8d@github.com> Message-ID: > The lowering of TypePattern was performing unnecessary check by invoking inexistent method on ExactConversionSupport e.g. `isIntToIntExact. Mourad Abbay has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision: - Test more - Merge branch 'code-reflection' into fix-lowering-type-pattern - Test we don't perform check for primitive identity conversion - Fix the logic of isNarrowingPrimitiveConversion ------------- Changes: - all: https://git.openjdk.org/babylon/pull/772/files - new: https://git.openjdk.org/babylon/pull/772/files/f347b86f..807cf3d5 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=772&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=772&range=00-01 Stats: 2730 lines in 173 files changed: 1525 ins; 726 del; 479 mod Patch: https://git.openjdk.org/babylon/pull/772.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/772/head:pull/772 PR: https://git.openjdk.org/babylon/pull/772 From psandoz at openjdk.org Fri Dec 19 22:43:21 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 19 Dec 2025 22:43:21 GMT Subject: [code-reflection] RFR: Lazily invoke lambda op building method [v3] In-Reply-To: References: Message-ID: <9dn4s6r-w18IRg2K6oTH6FI7l1AR6rMYsFr99DPmNlA=.041ef1a1-f3bb-4421-bf20-80c14622eb34@github.com> On Fri, 19 Dec 2025 22:32:08 GMT, Mourad Abbay wrote: >> Validation introduced in #738 is causing reflectable lambda creation to fail with an `InternalError`. The reason for this is that we are invoking lambda op building method in the lambda class static initializer, when lambda op building method throws UOE, it causes lambda creation to fail with `InternalError`. What we want is `Op.ofQuotable` to fail but not lambda instantiation. To adress this, we now lazily invoke lambda op building method and as result we lazily compute the `Quoted` instance, while sharing the lambda model across instances of the same lambda class. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Apply suggestions Marked as reviewed by psandoz (Lead). src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 564: > 562: /* > 563: private static synchronized CoreOp.FuncOp getModel() { > 564: if(model == null) { Suggestion: if (model == null) { ------------- PR Review: https://git.openjdk.org/babylon/pull/769#pullrequestreview-3600355819 PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636485889 From psandoz at openjdk.org Fri Dec 19 22:46:32 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 19 Dec 2025 22:46:32 GMT Subject: [code-reflection] RFR: Fix lowering type pattern [v2] In-Reply-To: References: <4tU4lVfEUUPcRGKM8GY7dh9PHzN5yn941PzgpXvkD9Y=.e283bea4-dd11-4aee-8fd2-2786e997fd8d@github.com> Message-ID: On Fri, 19 Dec 2025 22:41:28 GMT, Mourad Abbay wrote: >> The lowering of TypePattern was performing unnecessary check by invoking inexistent method on ExactConversionSupport e.g. `isIntToIntExact. > > Mourad Abbay has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision: > > - Test more > - Merge branch 'code-reflection' into fix-lowering-type-pattern > - Test we don't perform check for primitive identity conversion > - Fix the logic of isNarrowingPrimitiveConversion Marked as reviewed by psandoz (Lead). ------------- PR Review: https://git.openjdk.org/babylon/pull/772#pullrequestreview-3600371517 From psandoz at openjdk.org Fri Dec 19 22:46:34 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 19 Dec 2025 22:46:34 GMT Subject: [code-reflection] RFR: Fix lowering type pattern [v2] In-Reply-To: References: <4tU4lVfEUUPcRGKM8GY7dh9PHzN5yn941PzgpXvkD9Y=.e283bea4-dd11-4aee-8fd2-2786e997fd8d@github.com> Message-ID: <2fNhT2so2zqQ4OyXlLTJQEu1ZaL6mzBay-Ae4l0xQfc=.885b6168-84d5-454c-8ba5-dc3f244deadb@github.com> On Fri, 19 Dec 2025 22:32:24 GMT, Mourad Abbay wrote: >> src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java line 4937: >> >>> 4935: ); >>> 4936: private static boolean isNarrowingPrimitiveConv(PrimitiveType s, PrimitiveType t) { >>> 4937: return narrowingOrder.get(t) <= narrowingOrder.get(s) && !s.equals(t); // need to be strict, to not consider int -> int as narrowing >> >> Can you replace with `narrowingOrder.get(t) < narrowingOrder.get(s) || !s.equals(t)`? > > this way `byte -> int` will be considered narrowing Ah, yes i see now, got confused on the ordering. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/772#discussion_r2636500075 From gfrost at openjdk.org Sat Dec 20 11:20:32 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 20 Dec 2025 11:20:32 GMT Subject: git: openjdk/babylon: code-reflection: Slight cleanup of HatPtOp and added copyright to enum Message-ID: <2fdf352d-e1e3-4fe8-aa2b-14bee9759f4c@openjdk.org> Changeset: 65482632 Branch: code-reflection Author: Gary Frost Date: 2025-12-20 11:17:37 +0000 URL: https://git.openjdk.org/babylon/commit/654826323b49db3fb395932e65f7c535d1c7dd04 Slight cleanup of HatPtOp and added copyright to enum ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/dialect/BinaryOpEnum.java ! hat/core/src/main/java/hat/dialect/HATPtrOp.java From gfrost at openjdk.org Sat Dec 20 11:20:42 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 20 Dec 2025 11:20:42 GMT Subject: [code-reflection] Integrated: Slight cleanup of HatPtOp and added copyright to enum Message-ID: HATPtr housekeeping/cleanup and added copyright to BInaryOpEnum ------------- Commit messages: - Slight cleanup of HatPtOp and added copyright to enum Changes: https://git.openjdk.org/babylon/pull/773/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=773&range=00 Stats: 68 lines in 3 files changed: 45 ins; 22 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/773.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/773/head:pull/773 PR: https://git.openjdk.org/babylon/pull/773 From gfrost at openjdk.org Sat Dec 20 11:20:42 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 20 Dec 2025 11:20:42 GMT Subject: [code-reflection] Integrated: Slight cleanup of HatPtOp and added copyright to enum In-Reply-To: References: Message-ID: On Sat, 20 Dec 2025 11:13:37 GMT, Gary Frost wrote: > HATPtr housekeeping/cleanup and added copyright to BInaryOpEnum This pull request has now been integrated. Changeset: 65482632 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/654826323b49db3fb395932e65f7c535d1c7dd04 Stats: 68 lines in 3 files changed: 45 ins; 22 del; 1 mod Slight cleanup of HatPtOp and added copyright to enum ------------- PR: https://git.openjdk.org/babylon/pull/773 From gfrost at openjdk.org Sun Dec 21 11:28:54 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 11:28:54 GMT Subject: git: openjdk/babylon: code-reflection: Seal NDRange interfaces anc simplify HATThreadOp and phases Message-ID: Changeset: bf6d0ea8 Branch: code-reflection Author: Gary Frost Date: 2025-12-21 11:27:47 +0000 URL: https://git.openjdk.org/babylon/commit/bf6d0ea8ba9efad2878cd04c0e13236c6f2376bb Seal NDRange interfaces anc simplify HATThreadOp and phases ! hat/core/src/main/java/hat/NDRange.java ! hat/core/src/main/java/hat/dialect/HATBlockThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATLocalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATLocalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATThreadOp.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/phases/HATDialectifyThreadsPhase.java From gfrost at openjdk.org Sun Dec 21 11:31:34 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 11:31:34 GMT Subject: [code-reflection] Integrated: Seal NDRange interfaces anc simplify HATThreadOp and phases Message-ID: Sealed the NDRange (Local/Global) interface heirarchy. This helps in pattern switching. Also simpified the various HATThreadOp's . They all had common fields (name, resultType) so I pushed these down to the base HATThreadOp class. ------------- Commit messages: - Seal NDRange interfaces anc simplify HATThreadOp and phases Changes: https://git.openjdk.org/babylon/pull/775/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=775&range=00 Stats: 248 lines in 9 files changed: 72 ins; 107 del; 69 mod Patch: https://git.openjdk.org/babylon/pull/775.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/775/head:pull/775 PR: https://git.openjdk.org/babylon/pull/775 From gfrost at openjdk.org Sun Dec 21 11:31:35 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 11:31:35 GMT Subject: [code-reflection] Integrated: Seal NDRange interfaces anc simplify HATThreadOp and phases In-Reply-To: References: Message-ID: On Sun, 21 Dec 2025 11:24:25 GMT, Gary Frost wrote: > Sealed the NDRange (Local/Global) interface heirarchy. This helps in pattern switching. > > Also simpified the various HATThreadOp's . They all had common fields (name, resultType) so I pushed these down to the base HATThreadOp class. This pull request has now been integrated. Changeset: bf6d0ea8 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/bf6d0ea8ba9efad2878cd04c0e13236c6f2376bb Stats: 248 lines in 9 files changed: 72 ins; 107 del; 69 mod Seal NDRange interfaces anc simplify HATThreadOp and phases ------------- PR: https://git.openjdk.org/babylon/pull/775 From gfrost at openjdk.org Sun Dec 21 12:17:30 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 12:17:30 GMT Subject: [code-reflection] Integrated: Cleanup of HAT Cuda codegen Message-ID: Some cosmetic cleanup of cuda code gen ------------- Commit messages: - Cleanup of HAT Cuda codegen Changes: https://git.openjdk.org/babylon/pull/776/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=776&range=00 Stats: 191 lines in 2 files changed: 114 ins; 55 del; 22 mod Patch: https://git.openjdk.org/babylon/pull/776.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/776/head:pull/776 PR: https://git.openjdk.org/babylon/pull/776 From gfrost at openjdk.org Sun Dec 21 12:17:30 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 12:17:30 GMT Subject: [code-reflection] Integrated: Cleanup of HAT Cuda codegen In-Reply-To: References: Message-ID: On Sun, 21 Dec 2025 12:11:36 GMT, Gary Frost wrote: > Some cosmetic cleanup of cuda code gen This pull request has now been integrated. Changeset: 9c54679e Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/9c54679e0da23a10c043e9a8cb4908cba0a5a999 Stats: 191 lines in 2 files changed: 114 ins; 55 del; 22 mod Cleanup of HAT Cuda codegen ------------- PR: https://git.openjdk.org/babylon/pull/776 From gfrost at openjdk.org Sun Dec 21 12:17:49 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 12:17:49 GMT Subject: git: openjdk/babylon: code-reflection: Cleanup of HAT Cuda codegen Message-ID: Changeset: 9c54679e Branch: code-reflection Author: Gary Frost Date: 2025-12-21 12:14:02 +0000 URL: https://git.openjdk.org/babylon/commit/9c54679e0da23a10c043e9a8cb4908cba0a5a999 Cleanup of HAT Cuda codegen ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java From gfrost at openjdk.org Sun Dec 21 12:40:39 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 12:40:39 GMT Subject: git: openjdk/babylon: code-reflection: I messed up prev PR blockId vs blockIdx Message-ID: <0cec1d73-3ca1-4a8a-9a0d-498e5cb81299@openjdk.org> Changeset: 711c5a8e Branch: code-reflection Author: Gary Frost Date: 2025-12-21 12:38:17 +0000 URL: https://git.openjdk.org/babylon/commit/711c5a8e0860fc240b5e6886630acf8fe32e0579 I messed up prev PR blockId vs blockIdx ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java From gfrost at openjdk.org Sun Dec 21 12:42:18 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 12:42:18 GMT Subject: [code-reflection] Integrated: I messed up prev PR blockId vs blockIdx Message-ID: <-uRtgvpenymzwgUb4mgP6paVUlY9a2Y-oByzlzvnZxc=.b89ae678-8dc5-41a2-954d-7f5992c26f71@github.com> Testing on NVIDIA revealed a typo (blockId vs blockIdx) This should fix that. ------------- Commit messages: - I messed up prev PR blockId vs blockIdx Changes: https://git.openjdk.org/babylon/pull/777/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=777&range=00 Stats: 9 lines in 1 file changed: 0 ins; 0 del; 9 mod Patch: https://git.openjdk.org/babylon/pull/777.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/777/head:pull/777 PR: https://git.openjdk.org/babylon/pull/777 From gfrost at openjdk.org Sun Dec 21 12:42:19 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 12:42:19 GMT Subject: [code-reflection] Integrated: I messed up prev PR blockId vs blockIdx In-Reply-To: <-uRtgvpenymzwgUb4mgP6paVUlY9a2Y-oByzlzvnZxc=.b89ae678-8dc5-41a2-954d-7f5992c26f71@github.com> References: <-uRtgvpenymzwgUb4mgP6paVUlY9a2Y-oByzlzvnZxc=.b89ae678-8dc5-41a2-954d-7f5992c26f71@github.com> Message-ID: On Sun, 21 Dec 2025 12:35:50 GMT, Gary Frost wrote: > Testing on NVIDIA revealed a typo (blockId vs blockIdx) > > This should fix that. This pull request has now been integrated. Changeset: 711c5a8e Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/711c5a8e0860fc240b5e6886630acf8fe32e0579 Stats: 9 lines in 1 file changed: 0 ins; 0 del; 9 mod I messed up prev PR blockId vs blockIdx ------------- PR: https://git.openjdk.org/babylon/pull/777 From gfrost at openjdk.org Sun Dec 21 13:50:01 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 13:50:01 GMT Subject: git: openjdk/babylon: code-reflection: Sealed the HATOp/dialect hierarchy Message-ID: <2541c27e-1369-4a66-8045-724e108ef890@openjdk.org> Changeset: 91154887 Branch: code-reflection Author: Gary Frost Date: 2025-12-21 13:48:59 +0000 URL: https://git.openjdk.org/babylon/commit/911548878ff9b13bda31e099f29fcc8852715c50 Sealed the HATOp/dialect hierarchy ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/PTXHATKernelBuilder.java + hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/PTXPtrOp.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/ScopedCodeBuilderContext.java ! hat/core/src/main/java/hat/dialect/HATBarrierOp.java ! hat/core/src/main/java/hat/dialect/HATBlockThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATF16AddOp.java ! hat/core/src/main/java/hat/dialect/HATF16BinaryOp.java ! hat/core/src/main/java/hat/dialect/HATF16ConvOp.java ! hat/core/src/main/java/hat/dialect/HATF16DivOp.java ! hat/core/src/main/java/hat/dialect/HATF16MulOp.java ! hat/core/src/main/java/hat/dialect/HATF16Op.java ! hat/core/src/main/java/hat/dialect/HATF16SubOp.java ! hat/core/src/main/java/hat/dialect/HATF16ToFloatConvOp.java ! hat/core/src/main/java/hat/dialect/HATF16VarLoadOp.java ! hat/core/src/main/java/hat/dialect/HATF16VarOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATLocalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATLocalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATLocalVarOp.java ! hat/core/src/main/java/hat/dialect/HATMemoryDefOp.java ! hat/core/src/main/java/hat/dialect/HATMemoryLoadOp.java - hat/core/src/main/java/hat/dialect/HATMemoryOp.java + hat/core/src/main/java/hat/dialect/HATMemoryVarOp.java ! hat/core/src/main/java/hat/dialect/HATOp.java ! hat/core/src/main/java/hat/dialect/HATPhaseUtils.java ! hat/core/src/main/java/hat/dialect/HATPrivateInitVarOp.java ! hat/core/src/main/java/hat/dialect/HATPrivateVarOp.java ! hat/core/src/main/java/hat/dialect/HATPtrLengthOp.java ! hat/core/src/main/java/hat/dialect/HATPtrLoadOp.java ! hat/core/src/main/java/hat/dialect/HATPtrOp.java ! hat/core/src/main/java/hat/dialect/HATPtrStoreOp.java ! hat/core/src/main/java/hat/dialect/HATThreadOp.java ! hat/core/src/main/java/hat/dialect/HATVectorAddOp.java ! hat/core/src/main/java/hat/dialect/HATVectorBinaryOp.java ! hat/core/src/main/java/hat/dialect/HATVectorDivOp.java ! hat/core/src/main/java/hat/dialect/HATVectorLoadOp.java ! hat/core/src/main/java/hat/dialect/HATVectorMakeOfOp.java ! hat/core/src/main/java/hat/dialect/HATVectorMulOp.java ! hat/core/src/main/java/hat/dialect/HATVectorOfOp.java ! hat/core/src/main/java/hat/dialect/HATVectorOp.java ! hat/core/src/main/java/hat/dialect/HATVectorSelectLoadOp.java ! hat/core/src/main/java/hat/dialect/HATVectorSelectStoreOp.java ! hat/core/src/main/java/hat/dialect/HATVectorStoreView.java ! hat/core/src/main/java/hat/dialect/HATVectorSubOp.java ! hat/core/src/main/java/hat/dialect/HATVectorVarLoadOp.java ! hat/core/src/main/java/hat/dialect/HATVectorVarOp.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/phases/HATDialectifyBarrierPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyMemoryPhase.java From gfrost at openjdk.org Sun Dec 21 13:52:06 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 13:52:06 GMT Subject: [code-reflection] Integrated: Sealed the HATOp/dialect hierarchy Message-ID: Closed/Sealed the HATOp dialect heirarchy. Moved common code down to base class (we had a lot of duplicated code and shadowed fields) PTXPtr could not be kept as a HATOp (cross module) so it now just extends Op. ------------- Commit messages: - Sealed the HATOp/dialect hierarchy Changes: https://git.openjdk.org/babylon/pull/778/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=778&range=00 Stats: 384 lines in 55 files changed: 131 ins; 104 del; 149 mod Patch: https://git.openjdk.org/babylon/pull/778.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/778/head:pull/778 PR: https://git.openjdk.org/babylon/pull/778 From gfrost at openjdk.org Sun Dec 21 13:52:08 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 13:52:08 GMT Subject: [code-reflection] Integrated: Sealed the HATOp/dialect hierarchy In-Reply-To: References: Message-ID: <1kWY9_FADBFqAZxkNDJUyR-6dM3qiUxoV-4rwp3cIsA=.43be2304-5301-4c6f-81c9-efba7aba1761@github.com> On Sun, 21 Dec 2025 13:45:41 GMT, Gary Frost wrote: > Closed/Sealed the HATOp dialect heirarchy. > > Moved common code down to base class (we had a lot of duplicated code and shadowed fields) > > PTXPtr could not be kept as a HATOp (cross module) so it now just extends Op. This pull request has now been integrated. Changeset: 91154887 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/911548878ff9b13bda31e099f29fcc8852715c50 Stats: 384 lines in 55 files changed: 131 ins; 104 del; 149 mod Sealed the HATOp/dialect hierarchy ------------- PR: https://git.openjdk.org/babylon/pull/778 From gfrost at openjdk.org Sun Dec 21 14:19:08 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 14:19:08 GMT Subject: [code-reflection] RFR: Moved scopebuilder down to optkl Message-ID: Trying to push scope builder down to optkl ------------- Commit messages: - Moved scopebuilder down to optkl Changes: https://git.openjdk.org/babylon/pull/779/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=779&range=00 Stats: 51 lines in 16 files changed: 10 ins; 22 del; 19 mod Patch: https://git.openjdk.org/babylon/pull/779.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/779/head:pull/779 PR: https://git.openjdk.org/babylon/pull/779 From gfrost at openjdk.org Sun Dec 21 14:33:11 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 14:33:11 GMT Subject: [code-reflection] RFR: Moved scopebuilder down to optkl [v2] In-Reply-To: References: Message-ID: > Trying to push scope builder down to optkl Gary Frost has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits: - whitespace - Merge code-reflection - Moved scopebuilder down to optkl ------------- Changes: https://git.openjdk.org/babylon/pull/779/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=779&range=01 Stats: 58 lines in 16 files changed: 18 ins; 23 del; 17 mod Patch: https://git.openjdk.org/babylon/pull/779.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/779/head:pull/779 PR: https://git.openjdk.org/babylon/pull/779 From gfrost at openjdk.org Sun Dec 21 14:33:13 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 14:33:13 GMT Subject: [code-reflection] Integrated: Moved scopebuilder down to optkl In-Reply-To: References: Message-ID: On Sun, 21 Dec 2025 14:12:35 GMT, Gary Frost wrote: > Trying to push scope builder down to optkl This pull request has now been integrated. Changeset: 607318c3 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/607318c3af5cb04b72dd6ad35ef789214ad526ee Stats: 58 lines in 16 files changed: 18 ins; 23 del; 17 mod Moved scopebuilder down to optkl ------------- PR: https://git.openjdk.org/babylon/pull/779 From gfrost at openjdk.org Sun Dec 21 14:33:29 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 14:33:29 GMT Subject: git: openjdk/babylon: code-reflection: Moved scopebuilder down to optkl Message-ID: Changeset: 607318c3 Branch: code-reflection Author: Gary Frost Date: 2025-12-21 14:29:19 +0000 URL: https://git.openjdk.org/babylon/commit/607318c3af5cb04b72dd6ad35ef789214ad526ee Moved scopebuilder down to optkl ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLHATKernelBuilder.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLJExtractedHATKernelBuilder.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/C99JExtractedBackend.java ! hat/core/src/main/java/hat/codebuilders/BabylonKernelOpBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATComputeBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/dialect/HATF16Op.java ! hat/core/src/main/java/hat/dialect/HATMemoryVarOp.java ! hat/core/src/main/java/hat/dialect/HATVectorOp.java = hat/optkl/src/main/java/optkl/VarLikeOp.java = hat/optkl/src/main/java/optkl/codebuilders/ScopedCodeBuilderContext.java ! hat/tools/src/main/java/hat/tools/text/JavaHATCodeBuilder.java ! hat/tools/src/main/java/hat/tools/text/TestJavaHATCodeBuilder.java From gfrost at openjdk.org Sun Dec 21 17:07:00 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 17:07:00 GMT Subject: git: openjdk/babylon: code-reflection: We were needlessly passing accelerator around, as a Lookup carrier Message-ID: Changeset: a5d2fba0 Branch: code-reflection Author: Gary Frost Date: 2025-12-21 17:05:31 +0000 URL: https://git.openjdk.org/babylon/commit/a5d2fba0a19c9ee8549298f3bbc7c183593bf7c6 We were needlessly passing accelerator around, as a Lookup carrier = hat/.bld = hat/.clean = hat/.dot + hat/.optkl = hat/.run = hat/.sanity + hat/.test-suite = hat/.tool ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java ! hat/backends/ffi/mock/src/main/java/hat/backend/ffi/MockBackend.java ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/C99JExtractedBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/core/src/main/java/hat/Accelerator.java ! hat/core/src/main/java/hat/ComputeContext.java ! hat/core/src/main/java/hat/backend/BackendAdaptor.java ! hat/core/src/main/java/hat/backend/DebugBackend.java ! hat/core/src/main/java/hat/backend/java/JavaBackend.java ! hat/core/src/main/java/hat/buffer/ArgArray.java ! hat/core/src/main/java/hat/buffer/BF16Array.java ! hat/core/src/main/java/hat/buffer/F16Array.java ! hat/core/src/main/java/hat/buffer/F32Array.java ! hat/core/src/main/java/hat/buffer/F32Array2D.java ! hat/core/src/main/java/hat/buffer/F32ArrayPadded.java ! hat/core/src/main/java/hat/buffer/KernelBufferContext.java ! hat/core/src/main/java/hat/buffer/S08x3RGBImage.java ! hat/core/src/main/java/hat/buffer/S32Array.java ! hat/core/src/main/java/hat/buffer/S32Array2D.java ! hat/core/src/main/java/hat/buffer/S32RGBAImage.java ! hat/core/src/main/java/hat/buffer/U16GreyImage.java ! hat/core/src/main/java/hat/callgraph/CallGraph.java ! hat/core/src/main/java/hat/callgraph/ComputeCallGraph.java ! hat/core/src/main/java/hat/callgraph/Entrypoint.java ! hat/core/src/main/java/hat/callgraph/KernelCallGraph.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/device/DeviceSchema.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/phases/HATDialect.java ! hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyBarrierPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyFP16Phase.java ! hat/core/src/main/java/hat/phases/HATDialectifyMemoryPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyThreadsPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyTier.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorOpPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorSelectPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorStorePhase.java ! hat/core/src/main/java/hat/phases/HATFinalDetector.java = hat/core/src/main/java/hat/types/BF16.java = hat/core/src/main/java/hat/types/F16.java = hat/core/src/main/java/hat/types/Float2.java = hat/core/src/main/java/hat/types/Float4.java = hat/core/src/main/java/hat/types/HAType.java ! hat/examples/heal/src/main/java/heal/ComputeHeal.java ! hat/examples/matmul/src/main/java/matmul/Main.java ! hat/examples/nbody/src/main/java/nbody/Universe.java ! hat/examples/nbody/src/main/java/nbody/opencl/OpenCLNBodyGLWindow.java ! hat/examples/violajones/src/main/java/violajones/ViolaJonesCoreCompute.java ! hat/tests/src/main/java/hat/test/TestBFloat16Type.java ! hat/tests/src/main/java/hat/test/TestDeviceType.java ! hat/tests/src/main/java/hat/test/TestF16Type.java ! hat/tests/src/main/java/hat/test/TestFloat2.java ! hat/tests/src/main/java/hat/test/TestMatMul.java ! hat/tests/src/main/java/hat/test/TestVectorArrayView.java ! hat/tests/src/main/java/hat/test/TestVectorTypes.java ! hat/tests/src/main/java/hat/test/exceptions/HATAsserts.java From gfrost at openjdk.org Sun Dec 21 17:08:59 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 17:08:59 GMT Subject: [code-reflection] Integrated: We were needlessly passing accelerator around, as a Lookup carrier Message-ID: We added LookupCarrier interface recently, but were still passing around Accelerator as a LookupCarrier. Now we can define buffers in optkl and use them from HAT. Also we were using accelerator as an allocator (ArenaCarrier/BufferBuilder) so now we separate those as well. ------------- Commit messages: - We were needlessly passing accelerator around, as a Lookup carrier, now we pass as a LookupCarrier Changes: https://git.openjdk.org/babylon/pull/780/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=780&range=00 Stats: 536 lines in 70 files changed: 61 ins; 228 del; 247 mod Patch: https://git.openjdk.org/babylon/pull/780.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/780/head:pull/780 PR: https://git.openjdk.org/babylon/pull/780 From gfrost at openjdk.org Sun Dec 21 17:09:01 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 17:09:01 GMT Subject: [code-reflection] Integrated: We were needlessly passing accelerator around, as a Lookup carrier In-Reply-To: References: Message-ID: On Sun, 21 Dec 2025 17:03:24 GMT, Gary Frost wrote: > We added LookupCarrier interface recently, but were still passing around Accelerator as a LookupCarrier. > > Now we can define buffers in optkl and use them from HAT. > > Also we were using accelerator as an allocator (ArenaCarrier/BufferBuilder) so now we separate those as well. This pull request has now been integrated. Changeset: a5d2fba0 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/a5d2fba0a19c9ee8549298f3bbc7c183593bf7c6 Stats: 536 lines in 70 files changed: 61 ins; 228 del; 247 mod We were needlessly passing accelerator around, as a Lookup carrier ------------- PR: https://git.openjdk.org/babylon/pull/780 From ntv at openjdk.org Sun Dec 21 19:57:44 2025 From: ntv at openjdk.org (Nadeesh TV) Date: Sun, 21 Dec 2025 19:57:44 GMT Subject: [code-reflection] RFR: Throw an exception if the compute method is not annotated with @Reflect Message-ID: - Throw an exception if the compute method is not annotated with @Reflect - Add tests - Code style correction - added spacing consistently ------------- Commit messages: - Remove white space - Merge branch 'code-reflection' into compute-method-reflect-error - rebase - rebase - We were needlessly passing accelerator around, as a Lookup carrier - Moved scopebuilder down to optkl - rebase - I messed up prev PR blockId vs blockIdx - rebase - Seal NDRange interfaces anc simplify HATThreadOp and phases - ... and 2 more: https://git.openjdk.org/babylon/compare/a5d2fba0...d935ec89 Changes: https://git.openjdk.org/babylon/pull/774/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=774&range=00 Stats: 205 lines in 9 files changed: 172 ins; 28 del; 5 mod Patch: https://git.openjdk.org/babylon/pull/774.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/774/head:pull/774 PR: https://git.openjdk.org/babylon/pull/774 From gfrost at openjdk.org Sun Dec 21 19:57:44 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 21 Dec 2025 19:57:44 GMT Subject: [code-reflection] RFR: Throw an exception if the compute method is not annotated with @Reflect In-Reply-To: References: Message-ID: On Sun, 21 Dec 2025 00:20:39 GMT, Nadeesh TV wrote: > - Throw an exception if the compute method is not annotated with @Reflect > - Add tests > - Code style correction - added spacing consistently Thanks for this, and it looks good. (also thanks for fixing some formatting) I will sponsor once you get past the whitespace check above and integrate. ------------- PR Comment: https://git.openjdk.org/babylon/pull/774#issuecomment-3678710912 From duke at openjdk.org Sun Dec 21 19:57:45 2025 From: duke at openjdk.org (duke) Date: Sun, 21 Dec 2025 19:57:45 GMT Subject: [code-reflection] RFR: Throw an exception if the compute method is not annotated with @Reflect In-Reply-To: References: Message-ID: <21Uq3jV1vHxy1E--6pQ7FRK9mguQ8Y8eDMeNoaU7TZE=.7329fdd1-8013-4649-929b-6658d71496ec@github.com> On Sun, 21 Dec 2025 00:20:39 GMT, Nadeesh TV wrote: > - Throw an exception if the compute method is not annotated with @Reflect > - Add tests > - Code style correction - added spacing consistently @deleSerna Your change (at version d935ec89f01285185800ee4e18b56657264dcc1c) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/774#issuecomment-3679364959 From gfrost at openjdk.org Mon Dec 22 19:11:32 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 22 Dec 2025 19:11:32 GMT Subject: git: openjdk/babylon: code-reflection: Moved common code to optkl Message-ID: <0f01b0b9-11c3-461b-b996-2a15d126ee55@openjdk.org> Changeset: 3642d2b1 Branch: code-reflection Author: Gary Frost Date: 2025-12-22 19:08:27 +0000 URL: https://git.openjdk.org/babylon/commit/3642d2b1cfadeb8b07876f8a3a4668e79df99a10 Moved common code to optkl ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/PTXHATKernelBuilder.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/C99JExtractedBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/core/src/main/java/hat/Accelerator.java ! hat/core/src/main/java/hat/BufferTagger.java ! hat/core/src/main/java/hat/ComputeContext.java ! hat/core/src/main/java/hat/backend/DebugBackend.java ! hat/core/src/main/java/hat/buffer/S32Array.java ! hat/core/src/main/java/hat/callgraph/ComputeCallGraph.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/dialect/HATF16AddOp.java ! hat/core/src/main/java/hat/dialect/HATF16DivOp.java ! hat/core/src/main/java/hat/dialect/HATF16MulOp.java ! hat/core/src/main/java/hat/dialect/HATF16SubOp.java ! hat/core/src/main/java/hat/dialect/HATF16ToFloatConvOp.java ! hat/core/src/main/java/hat/dialect/HATF16VarLoadOp.java ! hat/core/src/main/java/hat/dialect/HATPtrLengthOp.java ! hat/core/src/main/java/hat/dialect/HATPtrLoadOp.java ! hat/core/src/main/java/hat/dialect/HATPtrStoreOp.java ! hat/core/src/main/java/hat/dialect/HATThreadOp.java ! hat/core/src/main/java/hat/dialect/HATVectorAddOp.java ! hat/core/src/main/java/hat/dialect/HATVectorDivOp.java ! hat/core/src/main/java/hat/dialect/HATVectorLoadOp.java ! hat/core/src/main/java/hat/dialect/HATVectorMulOp.java ! hat/core/src/main/java/hat/dialect/HATVectorSelectLoadOp.java ! hat/core/src/main/java/hat/dialect/HATVectorSubOp.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/optools/Trxfmr.java ! hat/core/src/main/java/hat/phases/HATDialect.java ! hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyBarrierPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyFP16Phase.java ! hat/core/src/main/java/hat/phases/HATDialectifyMemoryPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyThreadsPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorOpPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorSelectPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorStorePhase.java ! hat/core/src/main/java/hat/phases/HATFinalDetector.java ! hat/examples/experiments/src/main/java/experiments/DNA.java ! hat/examples/experiments/src/main/java/experiments/LayoutExample.java ! hat/examples/experiments/src/main/java/experiments/RawLayout.java = hat/examples/experiments/src/main/java/experiments/S32Array2DTest.java + hat/examples/experiments/src/main/java/experiments/S32ArrayNewSchemaTest.java ! hat/examples/experiments/src/main/java/experiments/Transform.java ! hat/intellij/example_experiments.iml ! hat/optkl/src/main/java/optkl/OpTkl.java + hat/optkl/src/main/java/optkl/Precedence.java ! hat/optkl/src/main/java/optkl/ifacemapper/Schema.java ! hat/tools/src/main/java/hat/tools/text/JavaHATCodeBuilder.java From gfrost at openjdk.org Mon Dec 22 19:12:01 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 22 Dec 2025 19:12:01 GMT Subject: [code-reflection] Integrated: Moved common code to optkl Message-ID: Looks like a huge change. But mostly moving code down to optkl ------------- Commit messages: - Moved common code to optkl Changes: https://git.openjdk.org/babylon/pull/781/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=781&range=00 Stats: 1725 lines in 53 files changed: 891 ins; 579 del; 255 mod Patch: https://git.openjdk.org/babylon/pull/781.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/781/head:pull/781 PR: https://git.openjdk.org/babylon/pull/781 From gfrost at openjdk.org Mon Dec 22 19:12:03 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 22 Dec 2025 19:12:03 GMT Subject: [code-reflection] Integrated: Moved common code to optkl In-Reply-To: References: Message-ID: <8YJWaqFP3Ami6mvEEWJSvmJFqDLOdI524-xTYbh0Ng8=.f84bc5b4-8a2d-4335-b141-75edf524c2da@github.com> On Mon, 22 Dec 2025 19:05:31 GMT, Gary Frost wrote: > Looks like a huge change. But mostly moving code down to optkl This pull request has now been integrated. Changeset: 3642d2b1 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/3642d2b1cfadeb8b07876f8a3a4668e79df99a10 Stats: 1725 lines in 53 files changed: 891 ins; 579 del; 255 mod Moved common code to optkl ------------- PR: https://git.openjdk.org/babylon/pull/781 From ntv at openjdk.org Mon Dec 22 23:35:24 2025 From: ntv at openjdk.org (Nadeesh TV) Date: Mon, 22 Dec 2025 23:35:24 GMT Subject: [code-reflection] RFR: Throw an exception if the compute method is not annotated with @Reflect In-Reply-To: References: Message-ID: On Sun, 21 Dec 2025 11:30:09 GMT, Gary Frost wrote: >> - Throw an exception if the compute method is not annotated with @Reflect >> - Add tests >> - Code style correction - added spacing consistently > > Thanks for this, and it looks good. (also thanks for fixing some formatting) > > I will sponsor once you get past the whitespace check above and integrate. @grfrost Can you please sponsor it after the review? ------------- PR Comment: https://git.openjdk.org/babylon/pull/774#issuecomment-3684545720 From gfrost at openjdk.org Tue Dec 23 10:14:21 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 23 Dec 2025 10:14:21 GMT Subject: git: openjdk/babylon: code-reflection: Throw an exception if the compute method is not annotated with @Reflect Message-ID: Changeset: cc124529 Branch: code-reflection Author: Nadeesh TV Committer: Gary Frost Date: 2025-12-23 10:13:39 +0000 URL: https://git.openjdk.org/babylon/commit/cc1245298e21e3ee12b7628c8e46ccf4dee45df4 Throw an exception if the compute method is not annotated with @Reflect ! hat/core/src/main/java/hat/ComputeContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATComputeBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATConfigBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/optkl/src/main/java/optkl/codebuilders/ScopedCodeBuilderContext.java + hat/tests/src/main/java/hat/test/TestMissingReflectAnnotation.java ! hat/tests/src/main/java/hat/test/exceptions/HATAsserts.java From ntv at openjdk.org Tue Dec 23 10:16:25 2025 From: ntv at openjdk.org (Nadeesh TV) Date: Tue, 23 Dec 2025 10:16:25 GMT Subject: [code-reflection] Integrated: Throw an exception if the compute method is not annotated with @Reflect In-Reply-To: References: Message-ID: On Sun, 21 Dec 2025 00:20:39 GMT, Nadeesh TV wrote: > - Throw an exception if the compute method is not annotated with @Reflect > - Add tests > - Code style correction - added spacing consistently This pull request has now been integrated. Changeset: cc124529 Author: Nadeesh TV Committer: Gary Frost URL: https://git.openjdk.org/babylon/commit/cc1245298e21e3ee12b7628c8e46ccf4dee45df4 Stats: 205 lines in 9 files changed: 172 ins; 28 del; 5 mod Throw an exception if the compute method is not annotated with @Reflect ------------- PR: https://git.openjdk.org/babylon/pull/774 From mabbay at openjdk.org Tue Dec 23 12:31:42 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 23 Dec 2025 12:31:42 GMT Subject: git: openjdk/babylon: code-reflection: Fix lowering type pattern Message-ID: <0542ef20-3d1a-4382-9875-552d6b968d92@openjdk.org> Changeset: 0cdfd85d Branch: code-reflection Author: Mourad Abbay Date: 2025-12-23 12:30:40 +0000 URL: https://git.openjdk.org/babylon/commit/0cdfd85d0624eed74d8e9c12e49c6442b9434ed6 Fix lowering type pattern Reviewed-by: psandoz ! src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java ! test/jdk/java/lang/reflect/code/TestPrimitiveTypePatterns.java From mabbay at openjdk.org Tue Dec 23 12:35:52 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 23 Dec 2025 12:35:52 GMT Subject: git: openjdk/babylon: code-reflection: Lazily invoke lambda op building method Message-ID: <8df4bc2a-68bb-4cc6-8ad6-5b1291be3ba3@openjdk.org> Changeset: ab78f0bd Branch: code-reflection Author: Mourad Abbay Date: 2025-12-23 12:34:30 +0000 URL: https://git.openjdk.org/babylon/commit/ab78f0bd857bbf121dba04a6c13f232a17af97bc Lazily invoke lambda op building method Reviewed-by: psandoz ! src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java + test/jdk/java/lang/reflect/code/TestOpOfMethod.java + test/jdk/java/lang/reflect/code/TestOpOfQuotable.java ! test/jdk/java/lang/reflect/code/writer/TestJavaVersionCheckerForLambdas.java - test/langtools/tools/javac/reflect/LambdaModelUniquenessTest.java - test/langtools/tools/javac/reflect/MethodModelUniquenessTest.java From mabbay at openjdk.org Tue Dec 23 12:36:26 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 23 Dec 2025 12:36:26 GMT Subject: [code-reflection] RFR: Fix lowering type pattern [v3] In-Reply-To: <4tU4lVfEUUPcRGKM8GY7dh9PHzN5yn941PzgpXvkD9Y=.e283bea4-dd11-4aee-8fd2-2786e997fd8d@github.com> References: <4tU4lVfEUUPcRGKM8GY7dh9PHzN5yn941PzgpXvkD9Y=.e283bea4-dd11-4aee-8fd2-2786e997fd8d@github.com> Message-ID: > The lowering of TypePattern was performing unnecessary check by invoking inexistent method on ExactConversionSupport e.g. `isIntToIntExact. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Remove outdated comment ------------- Changes: - all: https://git.openjdk.org/babylon/pull/772/files - new: https://git.openjdk.org/babylon/pull/772/files/807cf3d5..44474c11 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=772&range=02 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=772&range=01-02 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/772.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/772/head:pull/772 PR: https://git.openjdk.org/babylon/pull/772 From mabbay at openjdk.org Tue Dec 23 12:36:27 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 23 Dec 2025 12:36:27 GMT Subject: [code-reflection] Integrated: Fix lowering type pattern In-Reply-To: <4tU4lVfEUUPcRGKM8GY7dh9PHzN5yn941PzgpXvkD9Y=.e283bea4-dd11-4aee-8fd2-2786e997fd8d@github.com> References: <4tU4lVfEUUPcRGKM8GY7dh9PHzN5yn941PzgpXvkD9Y=.e283bea4-dd11-4aee-8fd2-2786e997fd8d@github.com> Message-ID: On Fri, 19 Dec 2025 20:47:35 GMT, Mourad Abbay wrote: > The lowering of TypePattern was performing unnecessary check by invoking inexistent method on ExactConversionSupport e.g. `isIntToIntExact. This pull request has now been integrated. Changeset: 0cdfd85d Author: Mourad Abbay URL: https://git.openjdk.org/babylon/commit/0cdfd85d0624eed74d8e9c12e49c6442b9434ed6 Stats: 7 lines in 2 files changed: 3 ins; 0 del; 4 mod Fix lowering type pattern Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/772 From mabbay at openjdk.org Tue Dec 23 12:38:30 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 23 Dec 2025 12:38:30 GMT Subject: [code-reflection] RFR: Lazily invoke lambda op building method [v4] In-Reply-To: References: Message-ID: > Validation introduced in #738 is causing reflectable lambda creation to fail with an `InternalError`. The reason for this is that we are invoking lambda op building method in the lambda class static initializer, when lambda op building method throws UOE, it causes lambda creation to fail with `InternalError`. What we want is `Op.ofQuotable` to fail but not lambda instantiation. To adress this, we now lazily invoke lambda op building method and as result we lazily compute the `Quoted` instance, while sharing the lambda model across instances of the same lambda class. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Update the equivalent Java code for helper methods ------------- Changes: - all: https://git.openjdk.org/babylon/pull/769/files - new: https://git.openjdk.org/babylon/pull/769/files/8d829495..72e9f5e0 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=769&range=03 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=769&range=02-03 Stats: 8 lines in 1 file changed: 2 ins; 0 del; 6 mod Patch: https://git.openjdk.org/babylon/pull/769.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/769/head:pull/769 PR: https://git.openjdk.org/babylon/pull/769 From mabbay at openjdk.org Tue Dec 23 12:38:32 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 23 Dec 2025 12:38:32 GMT Subject: [code-reflection] Integrated: Lazily invoke lambda op building method In-Reply-To: References: Message-ID: On Fri, 19 Dec 2025 16:02:42 GMT, Mourad Abbay wrote: > Validation introduced in #738 is causing reflectable lambda creation to fail with an `InternalError`. The reason for this is that we are invoking lambda op building method in the lambda class static initializer, when lambda op building method throws UOE, it causes lambda creation to fail with `InternalError`. What we want is `Op.ofQuotable` to fail but not lambda instantiation. To adress this, we now lazily invoke lambda op building method and as result we lazily compute the `Quoted` instance, while sharing the lambda model across instances of the same lambda class. This pull request has now been integrated. Changeset: ab78f0bd Author: Mourad Abbay URL: https://git.openjdk.org/babylon/commit/ab78f0bd857bbf121dba04a6c13f232a17af97bc Stats: 419 lines in 7 files changed: 233 ins; 176 del; 10 mod Lazily invoke lambda op building method Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/769 From gfrost at openjdk.org Tue Dec 23 12:43:54 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 23 Dec 2025 12:43:54 GMT Subject: git: openjdk/babylon: code-reflection: Sealed HATPhases (transformer) heierarchy and provided access to =?UTF-8?B?S2VybuKApg==?= Message-ID: Changeset: a8e512cf Branch: code-reflection Author: Gary Frost Date: 2025-12-23 12:41:12 +0000 URL: https://git.openjdk.org/babylon/commit/a8e512cf63c30e9abe27913e81b5af2b4583c451 Sealed HATPhases (transformer) heierarchy and provided access to Kern? ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/PTXHATKernelBuilder.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/backends/java/mt/src/main/java/hat/backend/java/JavaMultiThreadedBackend.java ! hat/backends/java/seq/src/main/java/hat/backend/java/JavaSequentialBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/C99JExtractedBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/core/src/main/java/hat/BufferTagger.java ! hat/core/src/main/java/hat/ComputeContext.java ! hat/core/src/main/java/hat/backend/DebugBackend.java ! hat/core/src/main/java/hat/buffer/ArgArray.java ! hat/core/src/main/java/hat/callgraph/CallGraph.java ! hat/core/src/main/java/hat/callgraph/ComputeCallGraph.java ! hat/core/src/main/java/hat/callgraph/Entrypoint.java ! hat/core/src/main/java/hat/callgraph/KernelCallGraph.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATComputeBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/dialect/HATF16VarOp.java ! hat/core/src/main/java/hat/dialect/HATMemoryVarOp.java ! hat/core/src/main/java/hat/dialect/HATVectorVarOp.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/optools/Trxfmr.java - hat/core/src/main/java/hat/phases/HATDialect.java + hat/core/src/main/java/hat/phases/HATDialectPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyBarrierPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyFP16Phase.java ! hat/core/src/main/java/hat/phases/HATDialectifyMemoryPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyThreadsPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyTier.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorOpPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorSelectPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorStorePhase.java ! hat/docs/hat-03-programming-model.md ! hat/docs/hat-04-01-interface-mapping.md ! hat/examples/blackscholes/src/main/java/blackscholes/Main.java ! hat/examples/experiments/src/main/java/experiments/DNA.java ! hat/examples/experiments/src/main/java/experiments/LayoutExample.java ! hat/examples/experiments/src/main/java/experiments/PrefixSum.java ! hat/examples/experiments/src/main/java/experiments/RawLayout.java ! hat/examples/experiments/src/main/java/experiments/Transform.java ! hat/examples/violajones/src/main/java/violajones/attic/ViolaJones.java + hat/optkl/src/main/java/optkl/CallSite.java ! hat/optkl/src/main/java/optkl/OpTkl.java ! hat/optkl/src/main/java/optkl/ParamVar.java ! hat/optkl/src/main/java/optkl/Precedence.java = hat/optkl/src/main/java/optkl/StatementLikeOp.java ! hat/tests/src/main/java/hat/test/TestArrayView.java ! hat/tests/src/main/java/hat/test/TestMatMul.java ! hat/tools/src/main/java/hat/tools/text/JavaHATCodeBuilder.java From gfrost at openjdk.org Tue Dec 23 12:44:04 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 23 Dec 2025 12:44:04 GMT Subject: [code-reflection] Integrated: Sealed HATPhases (transformer) heierarchy and provided access to =?UTF-8?B?S2VybuKApg==?= Message-ID: Sealed HATPhases (transformer) heierarchy Phases now have access to KernelCallGraph to allow them to update/access KernelCallGraph state. Move some code down to optkl which no longer depends on HAT ------------- Commit messages: - Sealed HATPhases (transformer) heierarchy and provided access to KernelCallGraph Changes: https://git.openjdk.org/babylon/pull/782/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=782&range=00 Stats: 780 lines in 52 files changed: 301 ins; 209 del; 270 mod Patch: https://git.openjdk.org/babylon/pull/782.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/782/head:pull/782 PR: https://git.openjdk.org/babylon/pull/782 From gfrost at openjdk.org Tue Dec 23 12:44:06 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 23 Dec 2025 12:44:06 GMT Subject: [code-reflection] Integrated: Sealed HATPhases (transformer) heierarchy and provided access to =?UTF-8?B?S2VybuKApg==?= In-Reply-To: References: Message-ID: On Tue, 23 Dec 2025 12:38:21 GMT, Gary Frost wrote: > Sealed HATPhases (transformer) heierarchy > Phases now have access to KernelCallGraph to allow them to update/access KernelCallGraph state. > Move some code down to optkl which no longer depends on HAT This pull request has now been integrated. Changeset: a8e512cf Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/a8e512cf63c30e9abe27913e81b5af2b4583c451 Stats: 780 lines in 52 files changed: 301 ins; 209 del; 270 mod Sealed HATPhases (transformer) heierarchy and provided access to Kern? ------------- PR: https://git.openjdk.org/babylon/pull/782 From gfrost at openjdk.org Tue Dec 23 13:13:23 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 23 Dec 2025 13:13:23 GMT Subject: git: openjdk/babylon: code-reflection: Missing import in TestMissingReflectAnnotation Message-ID: Changeset: 84e06638 Branch: code-reflection Author: Gary Frost Date: 2025-12-23 13:12:10 +0000 URL: https://git.openjdk.org/babylon/commit/84e06638c0139d41e98d90748d3e505a0b6ff5bb Missing import in TestMissingReflectAnnotation ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/hat.java ! hat/tests/src/main/java/hat/test/TestMissingReflectAnnotation.java From gfrost at openjdk.org Tue Dec 23 13:15:33 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 23 Dec 2025 13:15:33 GMT Subject: [code-reflection] Integrated: Missing import in TestMissingReflectAnnotation Message-ID: Test case had missing import. Also added tests to 'sanity' checks for whitespace + tab + copyright checking ------------- Commit messages: - Missing import in TestMissingReflectAnnotation Changes: https://git.openjdk.org/babylon/pull/783/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=783&range=00 Stats: 3 lines in 3 files changed: 1 ins; 0 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/783.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/783/head:pull/783 PR: https://git.openjdk.org/babylon/pull/783 From gfrost at openjdk.org Tue Dec 23 13:15:33 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 23 Dec 2025 13:15:33 GMT Subject: [code-reflection] Integrated: Missing import in TestMissingReflectAnnotation In-Reply-To: References: Message-ID: On Tue, 23 Dec 2025 13:09:51 GMT, Gary Frost wrote: > Test case had missing import. > > Also added tests to 'sanity' checks for whitespace + tab + copyright checking This pull request has now been integrated. Changeset: 84e06638 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/84e06638c0139d41e98d90748d3e505a0b6ff5bb Stats: 3 lines in 3 files changed: 1 ins; 0 del; 2 mod Missing import in TestMissingReflectAnnotation ------------- PR: https://git.openjdk.org/babylon/pull/783 From gfrost at openjdk.org Tue Dec 23 15:06:53 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 23 Dec 2025 15:06:53 GMT Subject: git: openjdk/babylon: code-reflection: Resolving quotable target seems to be broken - this patch fixes HAT Message-ID: Changeset: c86f4a24 Branch: code-reflection Author: Gary Frost Date: 2025-12-23 15:05:22 +0000 URL: https://git.openjdk.org/babylon/commit/c86f4a240677bb6bef06c597977d2941e3d6cce9 Resolving quotable target seems to be broken - this patch fixes HAT ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/examples/life/src/main/java/life/Viewer.java ! hat/intellij/.idea/misc.xml ! hat/intellij/example_life.iml ! hat/optkl/src/main/java/optkl/OpTkl.java From gfrost at openjdk.org Tue Dec 23 15:08:59 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 23 Dec 2025 15:08:59 GMT Subject: [code-reflection] Integrated: Resolving quotable target seems to be broken - this patch fixes HAT Message-ID: Weird issue showed up when I just synced I had to make this patch to correctly locate the lambda target from a quotable.. @@ -118,7 +119,12 @@ static JavaOp.InvokeOp getTargetInvokeOp(JavaOp.LambdaOp lambdaOp) { return lambdaOp.body().entryBlock().ops().stream() .filter(op -> op instanceof JavaOp.InvokeOp) .map(op -> (JavaOp.InvokeOp) op) - .findFirst().orElseThrow(); + .filter(invokeOp -> invokeOp.invokeKind().equals(JavaOp.InvokeOp.InvokeKind.STATIC)) + .filter(invokeOp -> invokeOp.operands().get(0).type() instanceof ClassType classType + && classType.toClassName() instanceof String name + && (name.equals("hat.ComputeContext")||name.equals("hat.KernelContext"))) + .findFirst() + .orElseThrow(); } ``` Previously I did not have to filter the steam, the first invokeOp was the always the target. Possibly this was just a fluke. What made this really weird is that the test suite all passed and all examples except 'Lifer' Life example gave me an error... but only when I ran with 'MINIMIZE_COPIES' turned on. ------------- Commit messages: - Resolving quotable target seems to be broken - this patch fixes HAT Changes: https://git.openjdk.org/babylon/pull/784/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=784&range=00 Stats: 26 lines in 5 files changed: 10 ins; 4 del; 12 mod Patch: https://git.openjdk.org/babylon/pull/784.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/784/head:pull/784 PR: https://git.openjdk.org/babylon/pull/784 From gfrost at openjdk.org Tue Dec 23 15:08:59 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 23 Dec 2025 15:08:59 GMT Subject: [code-reflection] Integrated: Resolving quotable target seems to be broken - this patch fixes HAT In-Reply-To: References: Message-ID: On Tue, 23 Dec 2025 15:02:44 GMT, Gary Frost wrote: > Weird issue showed up when I just synced > > I had to make this patch to correctly locate the lambda target from a quotable.. > > @@ -118,7 +119,12 @@ static JavaOp.InvokeOp getTargetInvokeOp(JavaOp.LambdaOp lambdaOp) { > return lambdaOp.body().entryBlock().ops().stream() > .filter(op -> op instanceof JavaOp.InvokeOp) > .map(op -> (JavaOp.InvokeOp) op) > - .findFirst().orElseThrow(); > + .filter(invokeOp -> invokeOp.invokeKind().equals(JavaOp.InvokeOp.InvokeKind.STATIC)) > + .filter(invokeOp -> invokeOp.operands().get(0).type() instanceof ClassType classType > + && classType.toClassName() instanceof String name > + && (name.equals("hat.ComputeContext")||name.equals("hat.KernelContext"))) > + .findFirst() > + .orElseThrow(); > } > ``` > Previously I did not have to filter the steam, the first invokeOp was the always the target. Possibly this was just a fluke. > > What made this really weird is that the test suite all passed and all examples except 'Lifer' > > Life example gave me an error... but only when I ran with 'MINIMIZE_COPIES' turned on. This pull request has now been integrated. Changeset: c86f4a24 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/c86f4a240677bb6bef06c597977d2941e3d6cce9 Stats: 26 lines in 5 files changed: 10 ins; 4 del; 12 mod Resolving quotable target seems to be broken - this patch fixes HAT ------------- PR: https://git.openjdk.org/babylon/pull/784 From mabbay at openjdk.org Tue Dec 23 15:53:47 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 23 Dec 2025 15:53:47 GMT Subject: [code-reflection] RFR: 8373573: JavaOp.SwitchExpressionOp with unconditional pattern lowers to an invalid code model Message-ID: Lowering of SwitchExpressionOp that has unconditional pattern is producing an invalid model. ------------- Commit messages: - Fix lowering of SwitchExpressionOp that has unconditional pattern Changes: https://git.openjdk.org/babylon/pull/785/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=785&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8373573 Stats: 5 lines in 1 file changed: 5 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/785.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/785/head:pull/785 PR: https://git.openjdk.org/babylon/pull/785 From asotona at openjdk.org Tue Dec 23 18:14:31 2025 From: asotona at openjdk.org (Adam Sotona) Date: Tue, 23 Dec 2025 18:14:31 GMT Subject: [code-reflection] RFR: Unreflect tests [v4] In-Reply-To: References: Message-ID: <7GG9CabzXUclyTgcvYa9aT4ix1tlIN7QxlL-j5ULq1E=.dce53316-0700-4a12-bb8b-8952f202a7e8@github.com> > This PR implement `Unreflect` test tool and re-runs tests in the unreflected form. > > `TestSwitchExpressionOp` and `TestSwitchStatementOp` yet to be temporary excluded as failing (see [JDK-8373573](https://bugs.openjdk.org/browse/JDK-8373573)). Adam Sotona has updated the pull request incrementally with three additional commits since the last revision: - unreflect lambdas - test tags cleanup - nit fixes ------------- Changes: - all: https://git.openjdk.org/babylon/pull/762/files - new: https://git.openjdk.org/babylon/pull/762/files/ff2ff45e..0ed2a375 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=762&range=03 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=762&range=02-03 Stats: 112 lines in 5 files changed: 99 ins; 5 del; 8 mod Patch: https://git.openjdk.org/babylon/pull/762.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/762/head:pull/762 PR: https://git.openjdk.org/babylon/pull/762 From gfrost at openjdk.org Wed Dec 24 13:09:43 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 24 Dec 2025 13:09:43 GMT Subject: [code-reflection] Integrated: Cache kernel call sites based on lambdaOp location Message-ID: Recently discovered a bug with MINIMIZE_COPIES turned on (Game of life) First time we saw the compute dispatch we located the compute entrypoint which had no pre/post access. We then created compute and kernel callgraphs and injected pre/post mutate calls in the whole compute callgraph (including the lambda) we were processing. On the first call the kernel executed just fine. On subsequent compute calls we tried to crack the compute lambda again... This time we tripped over the now 'mutated' lambda (with pre/post access mutations) Turned out that we were doing more work than needed on each dispatch. So now we cache the callsite and only look through the model to crack the lambda and process the callgraphs once. So this turned out to be not only more correct (and stable) it also brought a not insignificant perf gain. ------------- Commit messages: - Cachekernel call sites based on lambdaOp location Changes: https://git.openjdk.org/babylon/pull/786/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=786&range=00 Stats: 66 lines in 6 files changed: 13 ins; 30 del; 23 mod Patch: https://git.openjdk.org/babylon/pull/786.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/786/head:pull/786 PR: https://git.openjdk.org/babylon/pull/786 From gfrost at openjdk.org Wed Dec 24 13:09:44 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 24 Dec 2025 13:09:44 GMT Subject: [code-reflection] Integrated: Cache kernel call sites based on lambdaOp location In-Reply-To: References: Message-ID: On Wed, 24 Dec 2025 13:04:01 GMT, Gary Frost wrote: > Recently discovered a bug with MINIMIZE_COPIES turned on (Game of life) > > First time we saw the compute dispatch we located the compute entrypoint which had no pre/post access. > > We then created compute and kernel callgraphs and injected pre/post mutate calls in the whole compute callgraph (including the lambda) we were processing. > > On the first call the kernel executed just fine. > > On subsequent compute calls we tried to crack the compute lambda again... > This time we tripped over the now 'mutated' lambda (with pre/post access mutations) > > Turned out that we were doing more work than needed on each dispatch. > > So now we cache the callsite and only look through the model to crack the lambda and process the callgraphs once. > > So this turned out to be not only more correct (and stable) it also brought a not insignificant perf gain. This pull request has now been integrated. Changeset: 2ac0eff7 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/2ac0eff7345088426dd22ac577cedb9b3ae7753c Stats: 66 lines in 6 files changed: 13 ins; 30 del; 23 mod Cache kernel call sites based on lambdaOp location ------------- PR: https://git.openjdk.org/babylon/pull/786 From gfrost at openjdk.org Wed Dec 24 13:10:14 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 24 Dec 2025 13:10:14 GMT Subject: git: openjdk/babylon: code-reflection: Cache kernel call sites based on lambdaOp location Message-ID: <49cab596-a653-44ea-a622-c7eac8818913@openjdk.org> Changeset: 2ac0eff7 Branch: code-reflection Author: Gary Frost Date: 2025-12-24 13:07:09 +0000 URL: https://git.openjdk.org/babylon/commit/2ac0eff7345088426dd22ac577cedb9b3ae7753c Cache kernel call sites based on lambdaOp location ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/C99JExtractedBackend.java ! hat/core/src/main/java/hat/Accelerator.java ! hat/core/src/main/java/hat/ComputeContext.java ! hat/core/src/main/java/hat/callgraph/CallGraph.java ! hat/examples/life/src/main/java/life/Main.java ! hat/optkl/src/main/java/optkl/OpTkl.java From gfrost at openjdk.org Wed Dec 24 19:01:08 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 24 Dec 2025 19:01:08 GMT Subject: git: openjdk/babylon: code-reflection: Hat switch from pattern to regex Message-ID: <62c45c7f-0ca1-4629-889a-695ff9b3bf0e@openjdk.org> Changeset: ff03a602 Branch: code-reflection Author: Gary Frost Date: 2025-12-24 18:57:45 +0000 URL: https://git.openjdk.org/babylon/commit/ff03a6025e855ce36dd249f2dd5da9a8774c4432 Hat switch from pattern to regex ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/core/src/main/java/hat/NDRange.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/dialect/HATBlockThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATLocalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATLocalThreadIdOp.java ! hat/core/src/main/java/hat/optools/OpTk.java ! hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyThreadsPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorSelectPhase.java ! hat/core/src/main/java/hat/phases/HATFinalDetector.java + hat/examples/experiments/src/main/java/experiments/CreateFuncOp.java + hat/examples/experiments/src/main/java/experiments/JavaPMe.java ! hat/examples/experiments/src/main/java/experiments/Transform.java ! hat/hat/job/src/main/java/job/Intellij.java ! hat/optkl/src/main/java/optkl/CallSite.java ! hat/optkl/src/main/java/optkl/OpTkl.java ! hat/optkl/src/main/java/optkl/textmodel/BabylonTextModel.java From gfrost at openjdk.org Wed Dec 24 19:01:34 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 24 Dec 2025 19:01:34 GMT Subject: [code-reflection] Integrated: Hat switch from pattern to regex Message-ID: Replaced Pattern with Regex. Cleaned up some op pattern matches using Optlk helpers ------------- Commit messages: - Some housekeeping - Replace Pattern with Regex and cleanup some Op matches Changes: https://git.openjdk.org/babylon/pull/787/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=787&range=00 Stats: 295 lines in 20 files changed: 200 ins; 36 del; 59 mod Patch: https://git.openjdk.org/babylon/pull/787.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/787/head:pull/787 PR: https://git.openjdk.org/babylon/pull/787 From gfrost at openjdk.org Wed Dec 24 19:01:36 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 24 Dec 2025 19:01:36 GMT Subject: [code-reflection] Integrated: Hat switch from pattern to regex In-Reply-To: References: Message-ID: <0q3ov8c-zFbeM6E7a783w51HB_JTXcSiRbr6Ch-lZKY=.bdf62909-0aba-421e-bb06-a02c7773828c@github.com> On Wed, 24 Dec 2025 18:55:07 GMT, Gary Frost wrote: > Replaced Pattern with Regex. > > Cleaned up some op pattern matches using Optlk helpers This pull request has now been integrated. Changeset: ff03a602 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/ff03a6025e855ce36dd249f2dd5da9a8774c4432 Stats: 295 lines in 20 files changed: 200 ins; 36 del; 59 mod Hat switch from pattern to regex ------------- PR: https://git.openjdk.org/babylon/pull/787 From gfrost at openjdk.org Fri Dec 26 12:17:53 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 26 Dec 2025 12:17:53 GMT Subject: [code-reflection] Integrated: More phase refactoring, created common op pattern matchers Message-ID: More cleanup of dialect transformation phases. Trying to seal the whole phase class hierarchy Established some common patterns ------------- Commit messages: - More phase refactoring, created common op pattern matchers Changes: https://git.openjdk.org/babylon/pull/789/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=789&range=00 Stats: 931 lines in 30 files changed: 504 ins; 335 del; 92 mod Patch: https://git.openjdk.org/babylon/pull/789.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/789/head:pull/789 PR: https://git.openjdk.org/babylon/pull/789 From gfrost at openjdk.org Fri Dec 26 12:17:56 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 26 Dec 2025 12:17:56 GMT Subject: [code-reflection] Integrated: More phase refactoring, created common op pattern matchers In-Reply-To: References: Message-ID: On Fri, 26 Dec 2025 12:12:53 GMT, Gary Frost wrote: > More cleanup of dialect transformation phases. > > Trying to seal the whole phase class hierarchy > > Established some common patterns This pull request has now been integrated. Changeset: 06c18e72 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/06c18e72bab8d4339a5ca5f3f68a66c534b994e3 Stats: 931 lines in 30 files changed: 504 ins; 335 del; 92 mod More phase refactoring, created common op pattern matchers ------------- PR: https://git.openjdk.org/babylon/pull/789 From gfrost at openjdk.org Fri Dec 26 12:18:50 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 26 Dec 2025 12:18:50 GMT Subject: git: openjdk/babylon: code-reflection: More phase refactoring, created common op pattern matchers Message-ID: <33a54f85-cd3f-470c-a3ac-518c26407ea1@openjdk.org> Changeset: 06c18e72 Branch: code-reflection Author: Gary Frost Date: 2025-12-26 12:15:12 +0000 URL: https://git.openjdk.org/babylon/commit/06c18e72bab8d4339a5ca5f3f68a66c534b994e3 More phase refactoring, created common op pattern matchers ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/PTXHATKernelBuilder.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/core/src/main/java/hat/Accelerator.java ! hat/core/src/main/java/hat/callgraph/ComputeCallGraph.java ! hat/core/src/main/java/hat/callgraph/KernelCallGraph.java ! hat/core/src/main/java/hat/codebuilders/BabylonKernelOpBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/dialect/HATBlockThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATLocalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATLocalThreadIdOp.java + hat/core/src/main/java/hat/optools/CodeModelPattern.java + hat/core/src/main/java/hat/optools/ComputeContextPattern.java + hat/core/src/main/java/hat/optools/IfaceBufferPattern.java + hat/core/src/main/java/hat/optools/KernelContextPattern.java - hat/core/src/main/java/hat/optools/OpTk.java + hat/core/src/main/java/hat/optools/RefactorMe.java ! hat/core/src/main/java/hat/optools/Trxfmr.java ! hat/core/src/main/java/hat/phases/HATDialectifyBarrierPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyFP16Phase.java ! hat/core/src/main/java/hat/phases/HATDialectifyMemoryPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyThreadsPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorOpPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorSelectPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorStorePhase.java ! hat/tools/src/main/java/hat/tools/text/JavaHATCodeBuilder.java From gfrost at openjdk.org Sat Dec 27 12:33:56 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 27 Dec 2025 12:33:56 GMT Subject: git: openjdk/babylon: code-reflection: Switched to using schema dsl rather than annotions for field order Message-ID: Changeset: 13298c2c Branch: code-reflection Author: Gary Frost Date: 2025-12-27 12:31:25 +0000 URL: https://git.openjdk.org/babylon/commit/13298c2c4d92813977dbfbaa7184151dd62863c1 Switched to using schema dsl rather than annotions for field order ! hat/core/src/main/java/hat/buffer/F32Array.java ! hat/core/src/main/java/hat/buffer/KernelBufferContext.java ! hat/core/src/main/java/hat/buffer/S32Array.java ! hat/examples/experiments/src/main/java/experiments/S32ArrayNewSchemaTest.java - hat/optkl/src/main/java/optkl/annotations/After.java - hat/optkl/src/main/java/optkl/annotations/Align.java - hat/optkl/src/main/java/optkl/annotations/Order.java - hat/optkl/src/main/java/optkl/annotations/Pad.java ! hat/optkl/src/main/java/optkl/ifacemapper/Schema.java From gfrost at openjdk.org Sat Dec 27 12:35:08 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 27 Dec 2025 12:35:08 GMT Subject: [code-reflection] Integrated: Switched to using schema dsl rather than annotions for field order Message-ID: Rather than using annotations for field order for simple iterface mapped buffers we reflect on a schema method. See S32Array and F32Array ------------- Commit messages: - Switched to using schema dsl rather than annotions for field order Changes: https://git.openjdk.org/babylon/pull/790/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=790&range=00 Stats: 295 lines in 9 files changed: 56 ins; 190 del; 49 mod Patch: https://git.openjdk.org/babylon/pull/790.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/790/head:pull/790 PR: https://git.openjdk.org/babylon/pull/790 From gfrost at openjdk.org Sat Dec 27 12:35:08 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 27 Dec 2025 12:35:08 GMT Subject: [code-reflection] Integrated: Switched to using schema dsl rather than annotions for field order In-Reply-To: References: Message-ID: <33IiPEsktQeGOU6zUDSj-Zf6J1X7Lgd2oSuEGkKP6NU=.e10c7843-9ba6-44a6-89d6-43c4e5aebe99@github.com> On Sat, 27 Dec 2025 12:29:02 GMT, Gary Frost wrote: > Rather than using annotations for field order for simple iterface mapped buffers we reflect on a schema method. > > See S32Array and F32Array This pull request has now been integrated. Changeset: 13298c2c Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/13298c2c4d92813977dbfbaa7184151dd62863c1 Stats: 295 lines in 9 files changed: 56 ins; 190 del; 49 mod Switched to using schema dsl rather than annotions for field order ------------- PR: https://git.openjdk.org/babylon/pull/790 From gfrost at openjdk.org Sat Dec 27 15:04:23 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 27 Dec 2025 15:04:23 GMT Subject: [code-reflection] Integrated: Move hat annotations back to core. Some groupied of common classes Message-ID: Realized I had incorrectly pushed some HAT annotatopns down to optkl. Also took opportunity to grouo utility classes into common packages. ------------- Commit messages: - Move hat annotations up to HAT core. Some grouping of common utility classes Changes: https://git.openjdk.org/babylon/pull/791/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=791&range=00 Stats: 161 lines in 104 files changed: 4 ins; 42 del; 115 mod Patch: https://git.openjdk.org/babylon/pull/791.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/791/head:pull/791 PR: https://git.openjdk.org/babylon/pull/791 From gfrost at openjdk.org Sat Dec 27 15:04:23 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 27 Dec 2025 15:04:23 GMT Subject: [code-reflection] Integrated: Move hat annotations back to core. Some groupied of common classes In-Reply-To: References: Message-ID: <7dIiJDFupm1Wj_rOBquVmQlK9IwQssvGuPLjQ0DBqzI=.492c6171-2183-476d-8858-a584ade0aa8d@github.com> On Sat, 27 Dec 2025 14:58:12 GMT, Gary Frost wrote: > Realized I had incorrectly pushed some HAT annotatopns down to optkl. > > Also took opportunity to grouo utility classes into common packages. This pull request has now been integrated. Changeset: 0723973c Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/0723973c753f2ba28f02b472109c49866d098192 Stats: 161 lines in 104 files changed: 4 ins; 42 del; 115 mod Move hat annotations back to core. Some groupied of common classes ------------- PR: https://git.openjdk.org/babylon/pull/791 From gfrost at openjdk.org Sat Dec 27 15:05:59 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 27 Dec 2025 15:05:59 GMT Subject: git: openjdk/babylon: code-reflection: Move hat annotations back to core. Some groupied of common classes Message-ID: Changeset: 0723973c Branch: code-reflection Author: Gary Frost Date: 2025-12-27 15:00:59 +0000 URL: https://git.openjdk.org/babylon/commit/0723973c753f2ba28f02b472109c49866d098192 Move hat annotations back to core. Some groupied of common classes ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/C99JExtractedBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/core/src/main/java/hat/Accelerator.java ! hat/core/src/main/java/hat/BufferTagger.java ! hat/core/src/main/java/hat/ComputeContext.java ! hat/core/src/main/java/hat/FFIConfigCreator.java ! hat/core/src/main/java/hat/NDRange.java = hat/core/src/main/java/hat/annotations/Kernel.java = hat/core/src/main/java/hat/annotations/Preformatted.java = hat/core/src/main/java/hat/annotations/ProvidesDimFor.java = hat/core/src/main/java/hat/annotations/TypeDef.java ! hat/core/src/main/java/hat/backend/Backend.java ! hat/core/src/main/java/hat/backend/DebugBackend.java ! hat/core/src/main/java/hat/buffer/ArgArray.java ! hat/core/src/main/java/hat/buffer/BF16Array.java ! hat/core/src/main/java/hat/buffer/F32Array.java ! hat/core/src/main/java/hat/buffer/F32Array2D.java ! hat/core/src/main/java/hat/buffer/F32ArrayPadded.java ! hat/core/src/main/java/hat/buffer/KernelBufferContext.java ! hat/core/src/main/java/hat/buffer/S08x3RGBImage.java ! hat/core/src/main/java/hat/buffer/S32Array.java ! hat/core/src/main/java/hat/buffer/S32Array2D.java ! hat/core/src/main/java/hat/buffer/S32RGBAImage.java ! hat/core/src/main/java/hat/buffer/U16GreyImage.java ! hat/core/src/main/java/hat/callgraph/CallGraph.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/dialect/HATBlockThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATF16AddOp.java ! hat/core/src/main/java/hat/dialect/HATF16DivOp.java ! hat/core/src/main/java/hat/dialect/HATF16MulOp.java ! hat/core/src/main/java/hat/dialect/HATF16Op.java ! hat/core/src/main/java/hat/dialect/HATF16SubOp.java ! hat/core/src/main/java/hat/dialect/HATF16ToFloatConvOp.java ! hat/core/src/main/java/hat/dialect/HATF16VarLoadOp.java ! hat/core/src/main/java/hat/dialect/HATF16VarOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATLocalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATLocalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATMemoryVarOp.java ! hat/core/src/main/java/hat/dialect/HATPtrLengthOp.java ! hat/core/src/main/java/hat/dialect/HATPtrLoadOp.java ! hat/core/src/main/java/hat/dialect/HATPtrStoreOp.java ! hat/core/src/main/java/hat/dialect/HATThreadOp.java ! hat/core/src/main/java/hat/dialect/HATVectorAddOp.java ! hat/core/src/main/java/hat/dialect/HATVectorDivOp.java ! hat/core/src/main/java/hat/dialect/HATVectorLoadOp.java ! hat/core/src/main/java/hat/dialect/HATVectorMulOp.java ! hat/core/src/main/java/hat/dialect/HATVectorOp.java ! hat/core/src/main/java/hat/dialect/HATVectorSelectLoadOp.java ! hat/core/src/main/java/hat/dialect/HATVectorSubOp.java ! hat/core/src/main/java/hat/dialect/HATVectorVarOp.java ! hat/core/src/main/java/hat/optools/ComputeContextPattern.java ! hat/core/src/main/java/hat/optools/KernelContextPattern.java ! hat/core/src/main/java/hat/optools/Trxfmr.java ! hat/core/src/main/java/hat/phases/HATDialectPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyBarrierPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyFP16Phase.java ! hat/core/src/main/java/hat/phases/HATDialectifyMemoryPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyThreadsPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyTier.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorOpPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorSelectPhase.java ! hat/core/src/main/java/hat/phases/HATDialectifyVectorStorePhase.java ! hat/core/src/main/java/hat/phases/HATFinalDetector.java ! hat/examples/experiments/src/main/java/experiments/CreateFuncOp.java ! hat/examples/experiments/src/main/java/experiments/DNA.java ! hat/examples/experiments/src/main/java/experiments/LayoutExample.java ! hat/examples/experiments/src/main/java/experiments/PrefixSum.java ! hat/examples/experiments/src/main/java/experiments/RawLayout.java ! hat/examples/experiments/src/main/java/experiments/Transform.java ! hat/examples/view/src/main/java/view/EliteMeshParser.java ! hat/examples/view/src/main/java/view/f32/F32Mesh3D.java ! hat/optkl/src/main/java/optkl/FuncOpParams.java ! hat/optkl/src/main/java/optkl/OpTkl.java ! hat/optkl/src/main/java/optkl/codebuilders/CodeBuilder.java ! hat/optkl/src/main/java/optkl/codebuilders/ScopedCodeBuilderContext.java ! hat/optkl/src/main/java/optkl/ifacemapper/BufferAllocator.java ! hat/optkl/src/main/java/optkl/ifacemapper/MapperUtil.java ! hat/optkl/src/main/java/optkl/ifacemapper/Schema.java ! hat/optkl/src/main/java/optkl/ifacemapper/SegmentMapper.java ! hat/optkl/src/main/java/optkl/jdot/ui/JDot.java ! hat/optkl/src/main/java/optkl/textmodel/BabylonTextModel.java ! hat/optkl/src/main/java/optkl/textmodel/JavaTextModel.java ! hat/optkl/src/main/java/optkl/textmodel/tokens/DottedName.java ! hat/optkl/src/main/java/optkl/textmodel/tokens/IntConst.java ! hat/optkl/src/main/java/optkl/textmodel/tokens/Leaf.java = hat/optkl/src/main/java/optkl/util/BiMap.java = hat/optkl/src/main/java/optkl/util/CallSite.java = hat/optkl/src/main/java/optkl/util/OpCodeBuilder.java = hat/optkl/src/main/java/optkl/util/Regex.java = hat/optkl/src/main/java/optkl/util/StreamMutable.java = hat/optkl/src/main/java/optkl/util/carriers/ArenaCarrier.java = hat/optkl/src/main/java/optkl/util/carriers/CommonCarrier.java = hat/optkl/src/main/java/optkl/util/carriers/LookupCarrier.java = hat/optkl/src/main/java/optkl/util/ops/Precedence.java = hat/optkl/src/main/java/optkl/util/ops/StatementLikeOp.java = hat/optkl/src/main/java/optkl/util/ops/VarLikeOp.java ! hat/tools/src/main/java/hat/tools/text/TestJavaHATCodeBuilder.java From gfrost at openjdk.org Sat Dec 27 17:02:46 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 27 Dec 2025 17:02:46 GMT Subject: git: openjdk/babylon: code-reflection: Hat simplify phases Message-ID: <29bb2788-22f7-4773-92ed-606652bdf145@openjdk.org> Changeset: 6426322e Branch: code-reflection Author: Gary Frost Date: 2025-12-27 16:59:46 +0000 URL: https://git.openjdk.org/babylon/commit/6426322edf8218712cba1dc017c99294ee6d7179 Hat simplify phases ! hat/core/src/main/java/hat/NDRange.java ! hat/core/src/main/java/hat/callgraph/KernelCallGraph.java ! hat/core/src/main/java/hat/dialect/HATBlockThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATGlobalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATLocalSizeOp.java ! hat/core/src/main/java/hat/dialect/HATLocalThreadIdOp.java ! hat/core/src/main/java/hat/dialect/HATVectorStoreView.java ! hat/core/src/main/java/hat/optools/KernelContextPattern.java + hat/core/src/main/java/hat/optools/PatternSelector.java ! hat/core/src/main/java/hat/optools/Trxfmr.java = hat/core/src/main/java/hat/phases/HATArrayViewPhase.java + hat/core/src/main/java/hat/phases/HATBarrierPhase.java = hat/core/src/main/java/hat/phases/HATDMemoryPhase.java + hat/core/src/main/java/hat/phases/HATDTier.java - hat/core/src/main/java/hat/phases/HATDialectPhase.java - hat/core/src/main/java/hat/phases/HATDialectifyBarrierPhase.java - hat/core/src/main/java/hat/phases/HATDialectifyThreadsPhase.java - hat/core/src/main/java/hat/phases/HATDialectifyTier.java = hat/core/src/main/java/hat/phases/HATFP16Phase.java + hat/core/src/main/java/hat/phases/HATPhase.java + hat/core/src/main/java/hat/phases/HATThreadsPhase.java = hat/core/src/main/java/hat/phases/HATVectorPhase.java = hat/core/src/main/java/hat/phases/HATVectorSelectPhase.java = hat/core/src/main/java/hat/phases/HATVectorStorePhase.java ! hat/tools/src/main/java/hat/tools/text/JavaHATCodeBuilder.java From gfrost at openjdk.org Sat Dec 27 17:03:41 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 27 Dec 2025 17:03:41 GMT Subject: [code-reflection] Integrated: Hat simplify phases Message-ID: Some renaming and removal of duplicated classes. ------------- Commit messages: - cleaning up kernel transform phases - common renaming - cleaning up kernel transform phases - common renaming Changes: https://git.openjdk.org/babylon/pull/792/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=792&range=00 Stats: 872 lines in 26 files changed: 392 ins; 439 del; 41 mod Patch: https://git.openjdk.org/babylon/pull/792.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/792/head:pull/792 PR: https://git.openjdk.org/babylon/pull/792 From gfrost at openjdk.org Sat Dec 27 17:03:45 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 27 Dec 2025 17:03:45 GMT Subject: [code-reflection] Integrated: Hat simplify phases In-Reply-To: References: Message-ID: On Sat, 27 Dec 2025 16:55:40 GMT, Gary Frost wrote: > Some renaming and removal of duplicated classes. This pull request has now been integrated. Changeset: 6426322e Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/6426322edf8218712cba1dc017c99294ee6d7179 Stats: 872 lines in 26 files changed: 392 ins; 439 del; 41 mod Hat simplify phases ------------- PR: https://git.openjdk.org/babylon/pull/792 From gfrost at openjdk.org Sat Dec 27 17:44:45 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 27 Dec 2025 17:44:45 GMT Subject: git: openjdk/babylon: code-reflection: Moved some 'util' helpers into nested phase classes Message-ID: <2209a4cb-01e2-4443-8c66-45ef10e0f219@openjdk.org> Changeset: f30774b0 Branch: code-reflection Author: Gary Frost Date: 2025-12-27 17:41:50 +0000 URL: https://git.openjdk.org/babylon/commit/f30774b08e21a408b73fa314dfad6e1603125b82 Moved some 'util' helpers into nested phase classes ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLHATKernelBuilder.java ! hat/backends/jextracted/opencl/src/main/java/hat/backend/jextracted/OpenCLJExtractedHATKernelBuilder.java ! hat/core/src/main/java/hat/callgraph/KernelCallGraph.java ! hat/core/src/main/java/hat/codebuilders/BabylonKernelOpBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java - hat/core/src/main/java/hat/dialect/HATBlockThreadIdOp.java - hat/core/src/main/java/hat/dialect/HATF16AddOp.java - hat/core/src/main/java/hat/dialect/HATF16BinaryOp.java - hat/core/src/main/java/hat/dialect/HATF16ConvOp.java - hat/core/src/main/java/hat/dialect/HATF16DivOp.java - hat/core/src/main/java/hat/dialect/HATF16MulOp.java ! hat/core/src/main/java/hat/dialect/HATF16Op.java - hat/core/src/main/java/hat/dialect/HATF16SubOp.java - hat/core/src/main/java/hat/dialect/HATF16ToFloatConvOp.java - hat/core/src/main/java/hat/dialect/HATF16VarLoadOp.java - hat/core/src/main/java/hat/dialect/HATF16VarOp.java - hat/core/src/main/java/hat/dialect/HATGlobalSizeOp.java - hat/core/src/main/java/hat/dialect/HATGlobalThreadIdOp.java - hat/core/src/main/java/hat/dialect/HATLocalSizeOp.java - hat/core/src/main/java/hat/dialect/HATLocalThreadIdOp.java - hat/core/src/main/java/hat/dialect/HATLocalVarOp.java ! hat/core/src/main/java/hat/dialect/HATMemoryDefOp.java - hat/core/src/main/java/hat/dialect/HATMemoryLoadOp.java ! hat/core/src/main/java/hat/dialect/HATMemoryVarOp.java ! hat/core/src/main/java/hat/dialect/HATPhaseUtils.java - hat/core/src/main/java/hat/dialect/HATPrivateInitVarOp.java - hat/core/src/main/java/hat/dialect/HATPrivateVarOp.java - hat/core/src/main/java/hat/dialect/HATPtrLengthOp.java - hat/core/src/main/java/hat/dialect/HATPtrLoadOp.java ! hat/core/src/main/java/hat/dialect/HATPtrOp.java - hat/core/src/main/java/hat/dialect/HATPtrStoreOp.java ! hat/core/src/main/java/hat/dialect/HATThreadOp.java - hat/core/src/main/java/hat/dialect/HATVectorAddOp.java - hat/core/src/main/java/hat/dialect/HATVectorBinaryOp.java - hat/core/src/main/java/hat/dialect/HATVectorDivOp.java - hat/core/src/main/java/hat/dialect/HATVectorLoadOp.java - hat/core/src/main/java/hat/dialect/HATVectorMakeOfOp.java - hat/core/src/main/java/hat/dialect/HATVectorMulOp.java - hat/core/src/main/java/hat/dialect/HATVectorOfOp.java ! hat/core/src/main/java/hat/dialect/HATVectorOp.java - hat/core/src/main/java/hat/dialect/HATVectorSelectLoadOp.java - hat/core/src/main/java/hat/dialect/HATVectorSelectStoreOp.java - hat/core/src/main/java/hat/dialect/HATVectorStoreView.java - hat/core/src/main/java/hat/dialect/HATVectorSubOp.java - hat/core/src/main/java/hat/dialect/HATVectorVarLoadOp.java - hat/core/src/main/java/hat/dialect/HATVectorVarOp.java ! hat/core/src/main/java/hat/phases/HATArrayViewPhase.java - hat/core/src/main/java/hat/phases/HATDMemoryPhase.java ! hat/core/src/main/java/hat/phases/HATFP16Phase.java + hat/core/src/main/java/hat/phases/HATMemoryPhase.java ! hat/core/src/main/java/hat/phases/HATPhase.java ! hat/core/src/main/java/hat/phases/HATThreadsPhase.java = hat/core/src/main/java/hat/phases/HATTier.java ! hat/core/src/main/java/hat/phases/HATVectorPhase.java ! hat/core/src/main/java/hat/phases/HATVectorSelectPhase.java ! hat/core/src/main/java/hat/phases/HATVectorStorePhase.java From gfrost at openjdk.org Sat Dec 27 17:45:08 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 27 Dec 2025 17:45:08 GMT Subject: [code-reflection] Integrated: Moved some 'util' helpers into nested phase classes Message-ID: Moved sealed class heirarchy into nested classes (Ops and Phases) and moves util classes to the appropriate level of nesting ------------- Commit messages: - Moved some 'util' helpers into nested phase classes Changes: https://git.openjdk.org/babylon/pull/793/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=793&range=00 Stats: 4143 lines in 59 files changed: 1366 ins; 2557 del; 220 mod Patch: https://git.openjdk.org/babylon/pull/793.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/793/head:pull/793 PR: https://git.openjdk.org/babylon/pull/793 From gfrost at openjdk.org Sat Dec 27 17:45:09 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 27 Dec 2025 17:45:09 GMT Subject: [code-reflection] Integrated: Moved some 'util' helpers into nested phase classes In-Reply-To: References: Message-ID: On Sat, 27 Dec 2025 17:37:58 GMT, Gary Frost wrote: > Moved sealed class heirarchy into nested classes (Ops and Phases) and moves util classes to the appropriate level of nesting This pull request has now been integrated. Changeset: f30774b0 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/f30774b08e21a408b73fa314dfad6e1603125b82 Stats: 4143 lines in 59 files changed: 1366 ins; 2557 del; 220 mod Moved some 'util' helpers into nested phase classes ------------- PR: https://git.openjdk.org/babylon/pull/793 From gfrost at openjdk.org Sun Dec 28 14:14:51 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 28 Dec 2025 14:14:51 GMT Subject: git: openjdk/babylon: code-reflection: New dsl style schema extended to support 2D arrays bound by width*height Message-ID: <01b488ac-d29e-46e5-8525-e17eca77b06a@openjdk.org> Changeset: b7ee0943 Branch: code-reflection Author: Gary Frost Date: 2025-12-28 14:14:00 +0000 URL: https://git.openjdk.org/babylon/commit/b7ee0943de99b8ca2367bdf8c717d1dfaad0bde8 New dsl style schema extended to support 2D arrays bound by width*height ! hat/core/src/main/java/hat/buffer/F32Array2D.java ! hat/core/src/main/java/hat/buffer/F32ArrayPadded.java ! hat/core/src/main/java/hat/buffer/S32Array2D.java + hat/examples/experiments/src/main/java/experiments/S32Array2DNewSchemaTest.java ! hat/optkl/src/main/java/optkl/ifacemapper/Schema.java From gfrost at openjdk.org Sun Dec 28 14:18:23 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 28 Dec 2025 14:18:23 GMT Subject: [code-reflection] Integrated: New dsl style schema extended to support 2D arrays bound by width*height Message-ID: Extended the dsl style schema builder to accept 2D bound arrays,. public interface F32Array2D extends Buffer { @Reflect default void schema(){array(width()*height());}; Schema schema = Schema.of(F32Array2D.class); int width(); int height(); float array(long idx); void array(long idx, float v); } ------------- Commit messages: - New dsl style schema extended to support 2D arrays bound by width*height Changes: https://git.openjdk.org/babylon/pull/794/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=794&range=00 Stats: 208 lines in 5 files changed: 139 ins; 52 del; 17 mod Patch: https://git.openjdk.org/babylon/pull/794.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/794/head:pull/794 PR: https://git.openjdk.org/babylon/pull/794 From gfrost at openjdk.org Sun Dec 28 14:18:24 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 28 Dec 2025 14:18:24 GMT Subject: [code-reflection] Integrated: New dsl style schema extended to support 2D arrays bound by width*height In-Reply-To: References: Message-ID: On Sun, 28 Dec 2025 14:10:53 GMT, Gary Frost wrote: > Extended the dsl style schema builder to accept 2D bound arrays,. > > > public interface F32Array2D extends Buffer { > @Reflect default void schema(){array(width()*height());}; > Schema schema = Schema.of(F32Array2D.class); > > int width(); > > int height(); > > float array(long idx); > > void array(long idx, float v); > } This pull request has now been integrated. Changeset: b7ee0943 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/b7ee0943de99b8ca2367bdf8c717d1dfaad0bde8 Stats: 208 lines in 5 files changed: 139 ins; 52 del; 17 mod New dsl style schema extended to support 2D arrays bound by width*height ------------- PR: https://git.openjdk.org/babylon/pull/794 From asotona at openjdk.org Mon Dec 29 09:21:28 2025 From: asotona at openjdk.org (Adam Sotona) Date: Mon, 29 Dec 2025 09:21:28 GMT Subject: [code-reflection] RFR: 8373573: JavaOp.SwitchExpressionOp with unconditional pattern lowers to an invalid code model In-Reply-To: References: Message-ID: On Tue, 23 Dec 2025 15:45:22 GMT, Mourad Abbay wrote: > Lowering of SwitchExpressionOp that has unconditional pattern is producing an invalid model. Looks good to me. ------------- Marked as reviewed by asotona (Reviewer). PR Review: https://git.openjdk.org/babylon/pull/785#pullrequestreview-3615399023 From mabbay at openjdk.org Mon Dec 29 10:50:30 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Mon, 29 Dec 2025 10:50:30 GMT Subject: git: openjdk/babylon: code-reflection: 8373573: JavaOp.SwitchExpressionOp with unconditional pattern lowers to an invalid code model Message-ID: <5bd72f5e-212a-4848-8624-73ee5115b977@openjdk.org> Changeset: 7fdde0cb Branch: code-reflection Author: Mourad Abbay Date: 2025-12-29 10:48:57 +0000 URL: https://git.openjdk.org/babylon/commit/7fdde0cb936567cf88191bcec216cd537e5646ce 8373573: JavaOp.SwitchExpressionOp with unconditional pattern lowers to an invalid code model Reviewed-by: asotona ! src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java From mabbay at openjdk.org Mon Dec 29 10:51:57 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Mon, 29 Dec 2025 10:51:57 GMT Subject: [code-reflection] Integrated: 8373573: JavaOp.SwitchExpressionOp with unconditional pattern lowers to an invalid code model In-Reply-To: References: Message-ID: On Tue, 23 Dec 2025 15:45:22 GMT, Mourad Abbay wrote: > Lowering of SwitchExpressionOp that has unconditional pattern is producing an invalid model. This pull request has now been integrated. Changeset: 7fdde0cb Author: Mourad Abbay URL: https://git.openjdk.org/babylon/commit/7fdde0cb936567cf88191bcec216cd537e5646ce Stats: 5 lines in 1 file changed: 5 ins; 0 del; 0 mod 8373573: JavaOp.SwitchExpressionOp with unconditional pattern lowers to an invalid code model Reviewed-by: asotona ------------- PR: https://git.openjdk.org/babylon/pull/785 From gfrost at openjdk.org Mon Dec 29 15:46:21 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 29 Dec 2025 15:46:21 GMT Subject: git: openjdk/babylon: code-reflection: added some experiments for testing JavaCodeBuilder and Txfmr Message-ID: Changeset: 0bc4f1f3 Branch: code-reflection Author: Gary Frost Date: 2025-12-29 15:45:22 +0000 URL: https://git.openjdk.org/babylon/commit/0bc4f1f3e955638aceb3cc9042ad7087dc2e3e1c added some experiments for testing JavaCodeBuilder and Txfmr = hat/.exp = hat/.test ! hat/core/src/main/java/hat/codebuilders/C99HATCodeBuilderContext.java + hat/core/src/main/java/hat/codebuilders/JavaHATCodeBuilder.java ! hat/core/src/main/java/hat/optools/Trxfmr.java ! hat/examples/experiments/src/main/java/experiments/CreateFuncOp.java + hat/examples/experiments/src/main/java/experiments/SwapMath.java ! hat/optkl/src/main/java/optkl/FuncOpParams.java - hat/tools/src/main/java/hat/tools/text/JavaHATCodeBuilder.java ! hat/tools/src/main/java/hat/tools/text/TestJavaHATCodeBuilder.java From gfrost at openjdk.org Mon Dec 29 15:48:44 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 29 Dec 2025 15:48:44 GMT Subject: [code-reflection] Integrated: added some experiments for testing JavaCodeBuilder and Txfmr Message-ID: Some experiments for testing txfmr. Also moved JavaHATCodeBuilder from tools. It needs reparenting but is useful for debugging Found a bug in Txfmr which was stopping us from chaining transformations that removed ops. ------------- Commit messages: - added some experiments for testing JavaCodeBuilder and Txfmr Changes: https://git.openjdk.org/babylon/pull/795/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=795&range=00 Stats: 588 lines in 10 files changed: 404 ins; 124 del; 60 mod Patch: https://git.openjdk.org/babylon/pull/795.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/795/head:pull/795 PR: https://git.openjdk.org/babylon/pull/795 From gfrost at openjdk.org Mon Dec 29 15:48:46 2025 From: gfrost at openjdk.org (Gary Frost) Date: Mon, 29 Dec 2025 15:48:46 GMT Subject: [code-reflection] Integrated: added some experiments for testing JavaCodeBuilder and Txfmr In-Reply-To: References: Message-ID: <_KO67t1_wGZvyeECDVGqiRGiaFvqWrSpaZ-qJlxOKtI=.9b1bd065-b643-4302-ac53-9f6d8d607ecb@github.com> On Mon, 29 Dec 2025 15:41:51 GMT, Gary Frost wrote: > Some experiments for testing txfmr. > > Also moved JavaHATCodeBuilder from tools. It needs reparenting but is useful for debugging > > Found a bug in Txfmr which was stopping us from chaining transformations that removed ops. This pull request has now been integrated. Changeset: 0bc4f1f3 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/0bc4f1f3e955638aceb3cc9042ad7087dc2e3e1c Stats: 588 lines in 10 files changed: 404 ins; 124 del; 60 mod added some experiments for testing JavaCodeBuilder and Txfmr ------------- PR: https://git.openjdk.org/babylon/pull/795 From gfrost at openjdk.org Tue Dec 30 15:55:08 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 30 Dec 2025 15:55:08 GMT Subject: git: openjdk/babylon: code-reflection: Cleaning up HAT/Optkl transformers. Also removed dead transformer code Message-ID: Changeset: 02dc9acd Branch: code-reflection Author: Gary Frost Date: 2025-12-30 15:52:17 +0000 URL: https://git.openjdk.org/babylon/commit/02dc9acd3e9d2f81d16fa9d5e1a3b589f3e212c8 Cleaning up HAT/Optkl transformers. Also removed dead transformer code = hat/.help ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.java ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/core/src/main/java/hat/BufferTagger.java - hat/core/src/main/java/hat/backend/DebugBackend.java ! hat/core/src/main/java/hat/codebuilders/JavaHATCodeBuilder.java ! hat/core/src/main/java/hat/optools/KernelContextPattern.java - hat/core/src/main/java/hat/optools/PatternSelector.java - hat/core/src/main/java/hat/optools/Trxfmr.java ! hat/core/src/main/java/hat/phases/HATBarrierPhase.java ! hat/core/src/main/java/hat/phases/HATMemoryPhase.java ! hat/core/src/main/java/hat/phases/HATThreadsPhase.java ! hat/core/src/main/java/hat/phases/HATVectorPhase.java ! hat/core/src/main/java/hat/phases/HATVectorSelectPhase.java ! hat/core/src/main/java/hat/phases/HATVectorStorePhase.java ! hat/examples/experiments/src/main/java/experiments/CreateFuncOp.java ! hat/examples/experiments/src/main/java/experiments/DNA.java - hat/examples/experiments/src/main/java/experiments/LayoutExample.java - hat/examples/experiments/src/main/java/experiments/RawLayout.java ! hat/examples/experiments/src/main/java/experiments/S08x3ImageTest.java ! hat/examples/experiments/src/main/java/experiments/SwapMath.java ! hat/examples/experiments/src/main/java/experiments/Transform.java + hat/optkl/src/main/java/optkl/FieldAccessOpHelper.java + hat/optkl/src/main/java/optkl/InvokeOpHelper.java + hat/optkl/src/main/java/optkl/OpHelper.java ! hat/optkl/src/main/java/optkl/OpTkl.java + hat/optkl/src/main/java/optkl/Trxfmr.java ! hat/tools/src/main/java/hat/tools/text/TestJavaHATCodeBuilder.java From gfrost at openjdk.org Tue Dec 30 15:56:55 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 30 Dec 2025 15:56:55 GMT Subject: [code-reflection] Integrated: Cleaning up HAT/Optkl transformers. Also removed dead transformer code Message-ID: Removed dead transformer experimental code. Closing in on using opttkl.Txfrmr. Moved code down to optkl lib where possible ------------- Commit messages: - Cleaning up HAT/Optkl transformers. Also removed dead transformer code Changes: https://git.openjdk.org/babylon/pull/796/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=796&range=00 Stats: 2432 lines in 29 files changed: 627 ins; 1754 del; 51 mod Patch: https://git.openjdk.org/babylon/pull/796.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/796/head:pull/796 PR: https://git.openjdk.org/babylon/pull/796 From gfrost at openjdk.org Tue Dec 30 15:56:57 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 30 Dec 2025 15:56:57 GMT Subject: [code-reflection] Integrated: Cleaning up HAT/Optkl transformers. Also removed dead transformer code In-Reply-To: References: Message-ID: On Tue, 30 Dec 2025 15:49:13 GMT, Gary Frost wrote: > Removed dead transformer experimental code. > > Closing in on using opttkl.Txfrmr. > > Moved code down to optkl lib where possible This pull request has now been integrated. Changeset: 02dc9acd Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/02dc9acd3e9d2f81d16fa9d5e1a3b589f3e212c8 Stats: 2432 lines in 29 files changed: 627 ins; 1754 del; 51 mod Cleaning up HAT/Optkl transformers. Also removed dead transformer code ------------- PR: https://git.openjdk.org/babylon/pull/796 From gfrost at openjdk.org Tue Dec 30 18:55:59 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 30 Dec 2025 18:55:59 GMT Subject: git: openjdk/babylon: code-reflection: Previous PR was generating extras spaces and unused expression wanings Message-ID: Changeset: 1b4e52f5 Branch: code-reflection Author: Gary Frost Date: 2025-12-30 18:54:09 +0000 URL: https://git.openjdk.org/babylon/commit/1b4e52f5629dcbce09a465c486b0521c8bfc673d Previous PR was generating extras spaces and unused expression wanings ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/phases/HATBarrierPhase.java ! hat/examples/experiments/src/main/java/experiments/CreateFuncOp.java ! hat/optkl/src/main/java/optkl/Trxfmr.java From gfrost at openjdk.org Tue Dec 30 18:56:36 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 30 Dec 2025 18:56:36 GMT Subject: [code-reflection] Integrated: Previous PR was generating extras spaces and unused expression wanings Message-ID: Onl Nvidia OpenCl and CUDA compiler was complaining about unused expressions. These were the var remnant converting `kc.gix` to HAT_GIS.. We were leaving the var reference in the code model. I also removed some unnecessary spaces. ------------- Commit messages: - Previous PR was generating extras spaces and some unused expression warning nvidia only Changes: https://git.openjdk.org/babylon/pull/797/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=797&range=00 Stats: 56 lines in 4 files changed: 23 ins; 0 del; 33 mod Patch: https://git.openjdk.org/babylon/pull/797.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/797/head:pull/797 PR: https://git.openjdk.org/babylon/pull/797 From gfrost at openjdk.org Tue Dec 30 18:56:36 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 30 Dec 2025 18:56:36 GMT Subject: [code-reflection] Integrated: Previous PR was generating extras spaces and unused expression wanings In-Reply-To: References: Message-ID: <65S0S9ZiSPvAekr1HNzZjdZdDnj8su9JaVRRPgVRvLA=.29ef0ca3-4595-4346-8217-22697ca1bef3@github.com> On Tue, 30 Dec 2025 18:50:26 GMT, Gary Frost wrote: > Onl Nvidia OpenCl and CUDA compiler was complaining about unused expressions. > > These were the var remnant converting `kc.gix` to HAT_GIS.. We were leaving the var reference in the code model. > > I also removed some unnecessary spaces. This pull request has now been integrated. Changeset: 1b4e52f5 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/1b4e52f5629dcbce09a465c486b0521c8bfc673d Stats: 56 lines in 4 files changed: 23 ins; 0 del; 33 mod Previous PR was generating extras spaces and unused expression wanings ------------- PR: https://git.openjdk.org/babylon/pull/797 From ntv at openjdk.org Wed Dec 31 00:14:26 2025 From: ntv at openjdk.org (Nadeesh TV) Date: Wed, 31 Dec 2025 00:14:26 GMT Subject: [code-reflection] RFR: Improved error message on OpenCLBackend if Reflect annotation is missing on transitive methods from kernel method Message-ID: **Description** Currently, if we miss the **@Reflec**t annotation on methods called from kernel functions, no method is generated for them in the corresponding backend. This causes an error like: `> error: implicit declaration of function 'squareitWithoutReflectAnnotation' is invalid... ` **Solution** - Improved the error message by adding: *"Did you miss @Reflect annotation on the above function?"* for such cases. - Tried throwing an early error on the Java side, but calls to certain methods (e.g., `hat.buffer.S32Array.length()`) lack @Reflect annotations yet map to native functions later. Therefore, I could not find an easy early Java-side validation. **Test** - A new test is added at **hat.test.TestMissingReflectAnnotation#testTransitiveMethoFromKernelWithoutReflectAnnotation** - Output of the test case UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed buildStatus = failed logLen = 234 log = program_source:68:37: error: implicit declaration of function 'squareitWithoutReflectAnnotation' is invalid in OpenCL array->array[(long)HAT_GIX]=squareitWithoutReflectAnnotation(value); ^ Did you miss @Reflect annotation on the above function? Class: hat.test.TestMissingReflectAnnotation Testing: #testComputeMethodWithoutReflectAnnotation..................... [passed] Testing: #testKernelMethodWithoutReflectAnnotation..................... [passed] Testing: #testTransitiveMethoFromKernelWithoutReflectAnnotation..................... [passed] passed: 3, failed: 0, unsupported: 0, precision-errors: 0 ------------- Commit messages: - Removed extra whitespace - Improved error message on OpenCLBackend if Reflect annotation is missing on transitive methods from kernel method Changes: https://git.openjdk.org/babylon/pull/798/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=798&range=00 Stats: 60 lines in 2 files changed: 45 ins; 5 del; 10 mod Patch: https://git.openjdk.org/babylon/pull/798.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/798/head:pull/798 PR: https://git.openjdk.org/babylon/pull/798 From duke at openjdk.org Wed Dec 31 00:21:54 2025 From: duke at openjdk.org (duke) Date: Wed, 31 Dec 2025 00:21:54 GMT Subject: [code-reflection] RFR: Improved error message on OpenCLBackend if Reflect annotation is missing on transitive methods from kernel method In-Reply-To: References: Message-ID: On Wed, 31 Dec 2025 00:04:04 GMT, Nadeesh TV wrote: > **Description** > Currently, if we miss the **@Reflec**t annotation on methods called from kernel functions, no method is generated for them in the corresponding backend. This causes an error like: > > `> error: implicit declaration of function 'squareitWithoutReflectAnnotation' is invalid... > ` > **Solution** > - Improved the error message by adding: *"Did you miss @Reflect annotation on the above function?"* for such cases. > > - Tried throwing an early error on the Java side, but calls to certain methods (e.g., `hat.buffer.S32Array.length()`) lack @Reflect annotations yet map to native functions later. Therefore, I could not find an easy early Java-side validation. > > **Test** > - A new test is added at **hat.test.TestMissingReflectAnnotation#testTransitiveMethoFromKernelWithoutReflectAnnotation** > - Output of the test case > > UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed > buildStatus = failed > logLen = 234 log = program_source:68:37: error: implicit declaration of function 'squareitWithoutReflectAnnotation' is invalid in OpenCL > array->array[(long)HAT_GIX]=squareitWithoutReflectAnnotation(value); > ^ > > Did you miss @Reflect annotation on the above function? > > Class: hat.test.TestMissingReflectAnnotation > Testing: #testComputeMethodWithoutReflectAnnotation..................... [passed] > Testing: #testKernelMethodWithoutReflectAnnotation..................... [passed] > Testing: #testTransitiveMethoFromKernelWithoutReflectAnnotation..................... [passed] > > passed: 3, failed: 0, unsupported: 0, precision-errors: 0 @deleSerna Your change (at version 0afd2a0ce928acee1260582a65de4e5e4d88f203) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/798#issuecomment-3700904410 From ntv at openjdk.org Wed Dec 31 00:21:55 2025 From: ntv at openjdk.org (Nadeesh TV) Date: Wed, 31 Dec 2025 00:21:55 GMT Subject: [code-reflection] RFR: Improved error message on OpenCLBackend if Reflect annotation is missing on transitive methods from kernel method In-Reply-To: References: Message-ID: On Wed, 31 Dec 2025 00:04:04 GMT, Nadeesh TV wrote: > **Description** > Currently, if we miss the **@Reflec**t annotation on methods called from kernel functions, no method is generated for them in the corresponding backend. This causes an error like: > > `> error: implicit declaration of function 'squareitWithoutReflectAnnotation' is invalid... > ` > **Solution** > - Improved the error message by adding: *"Did you miss @Reflect annotation on the above function?"* for such cases. > > - Tried throwing an early error on the Java side, but calls to certain methods (e.g., `hat.buffer.S32Array.length()`) lack @Reflect annotations yet map to native functions later. Therefore, I could not find an easy early Java-side validation. > > **Test** > - A new test is added at **hat.test.TestMissingReflectAnnotation#testTransitiveMethoFromKernelWithoutReflectAnnotation** > - Output of the test case > > UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed > buildStatus = failed > logLen = 234 log = program_source:68:37: error: implicit declaration of function 'squareitWithoutReflectAnnotation' is invalid in OpenCL > array->array[(long)HAT_GIX]=squareitWithoutReflectAnnotation(value); > ^ > > Did you miss @Reflect annotation on the above function? > > Class: hat.test.TestMissingReflectAnnotation > Testing: #testComputeMethodWithoutReflectAnnotation..................... [passed] > Testing: #testKernelMethodWithoutReflectAnnotation..................... [passed] > Testing: #testTransitiveMethoFromKernelWithoutReflectAnnotation..................... [passed] > > passed: 3, failed: 0, unsupported: 0, precision-errors: 0 hat/backends/ffi/opencl/src/main/native/cpp/opencl_backend.cpp line 223: > 221: std::cerr << "clGetBuildInfo (getting log) failed" << std::endl; > 222: delete[] log; > 223: log = nullptr; @grfrost Not sure whether this delete was really needed. If I understood correctly, the destructor of `OpenCLProgram` should do this anyway, hence removed. But if you think otherwise let me know. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/798#discussion_r2654346277 From gfrost at openjdk.org Wed Dec 31 14:09:30 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 31 Dec 2025 14:09:30 GMT Subject: [code-reflection] RFR: Improved error message on OpenCLBackend if Reflect annotation is missing on transitive methods from kernel method In-Reply-To: References: Message-ID: On Wed, 31 Dec 2025 00:18:12 GMT, Nadeesh TV wrote: >> **Description** >> Currently, if we miss the **@Reflec**t annotation on methods called from kernel functions, no method is generated for them in the corresponding backend. This causes an error like: >> >> `> error: implicit declaration of function 'squareitWithoutReflectAnnotation' is invalid... >> ` >> **Solution** >> - Improved the error message by adding: *"Did you miss @Reflect annotation on the above function?"* for such cases. >> >> - Tried throwing an early error on the Java side, but calls to certain methods (e.g., `hat.buffer.S32Array.length()`) lack @Reflect annotations yet map to native functions later. Therefore, I could not find an easy early Java-side validation. >> >> **Test** >> - A new test is added at **hat.test.TestMissingReflectAnnotation#testTransitiveMethoFromKernelWithoutReflectAnnotation** >> - Output of the test case >> >> UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed >> buildStatus = failed >> logLen = 234 log = program_source:68:37: error: implicit declaration of function 'squareitWithoutReflectAnnotation' is invalid in OpenCL >> array->array[(long)HAT_GIX]=squareitWithoutReflectAnnotation(value); >> ^ >> >> Did you miss @Reflect annotation on the above function? >> >> Class: hat.test.TestMissingReflectAnnotation >> Testing: #testComputeMethodWithoutReflectAnnotation..................... [passed] >> Testing: #testKernelMethodWithoutReflectAnnotation..................... [passed] >> Testing: #testTransitiveMethoFromKernelWithoutReflectAnnotation..................... [passed] >> >> passed: 3, failed: 0, unsupported: 0, precision-errors: 0 > > hat/backends/ffi/opencl/src/main/native/cpp/opencl_backend.cpp line 223: > >> 221: std::cerr << "clGetBuildInfo (getting log) failed" << std::endl; >> 222: delete[] log; >> 223: log = nullptr; > > @grfrost Not sure whether this delete was really needed. > If I understood correctly, the destructor of `OpenCLProgram` should do this anyway, hence removed. But if you think otherwise let me know. Will look at the delete Q. You may be correct. Howver, we should not defer testing this until we get to ffi/cpp native code. This is detectable in the Java side way before we get to first kernel dispatch. If we go down this rabit hole we are forced to also do this in the CUDA/PTX and all future ffi implementations. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/798#discussion_r2655452496 From gfrost at openjdk.org Wed Dec 31 14:22:06 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 31 Dec 2025 14:22:06 GMT Subject: git: openjdk/babylon: code-reflection: Unified access type info.. also removed dead optkl.Trxfmr code Message-ID: Changeset: 331af889 Branch: code-reflection Author: Gary Frost Date: 2025-12-31 14:19:22 +0000 URL: https://git.openjdk.org/babylon/commit/331af889a36b4bc9f418842b80f1504c0b5ab1f3 Unified access type info.. also removed dead optkl.Trxfmr code ! hat/core/src/main/java/hat/BufferTagger.java ! hat/core/src/main/java/hat/buffer/ArgArray.java ! hat/core/src/main/java/hat/callgraph/KernelCallGraph.java ! hat/optkl/src/main/java/optkl/Trxfmr.java + hat/optkl/src/main/java/optkl/ifacemapper/AccessType.java From gfrost at openjdk.org Wed Dec 31 14:23:08 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 31 Dec 2025 14:23:08 GMT Subject: [code-reflection] Integrated: Unified access type info.. also removed dead optkl.Trxfmr code In-Reply-To: References: Message-ID: <6ChE8GbVKSJDKwfFCpqT7LvUt72Z0sS3fo2bBPnGJ5E=.68e68b2a-176a-431f-a484-f29cb676ffaf@github.com> On Wed, 31 Dec 2025 14:16:36 GMT, Gary Frost wrote: > We had duplicated code handling access info (RW/RO/WO etc) to handle annotations and enums. > > I merged the code here so the enum also matches the annotation info. This way we keep them in sync. > > I was concerned we may change the byte descripor bit positions in one place and spend days debugging (not realizing we had another supposedly identical byte layout). > > I moved this down info the iface mapper (from the Buffer Tracker) > > This greatly simplified handling this data in ArgArray buffer code. Which was bridging the two representations. > > Also removed some dead code in optkl.Trxfmr. This pull request has now been integrated. Changeset: 331af889 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/331af889a36b4bc9f418842b80f1504c0b5ab1f3 Stats: 277 lines in 5 files changed: 114 ins; 111 del; 52 mod Unified access type info.. also removed dead optkl.Trxfmr code ------------- PR: https://git.openjdk.org/babylon/pull/799 From gfrost at openjdk.org Wed Dec 31 14:23:06 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 31 Dec 2025 14:23:06 GMT Subject: [code-reflection] Integrated: Unified access type info.. also removed dead optkl.Trxfmr code Message-ID: We had duplicated code handling access info (RW/RO/WO etc) to handle annotations and enums. I merged the code here so the enum also matches the annotation info. This way we keep them in sync. I was concerned we may change the byte descripor bit positions in one place and spend days debugging (not realizing we had another supposedly identical byte layout). I moved this down info the iface mapper (from the Buffer Tracker) This greatly simplified handling this data in ArgArray buffer code. Which was bridging the two representations. Also removed some dead code in optkl.Trxfmr. ------------- Commit messages: - Unified access type info.. also removed dead optkl.Trxfmr code Changes: https://git.openjdk.org/babylon/pull/799/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=799&range=00 Stats: 277 lines in 5 files changed: 114 ins; 111 del; 52 mod Patch: https://git.openjdk.org/babylon/pull/799.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/799/head:pull/799 PR: https://git.openjdk.org/babylon/pull/799 From ntv at openjdk.org Wed Dec 31 15:26:24 2025 From: ntv at openjdk.org (Nadeesh TV) Date: Wed, 31 Dec 2025 15:26:24 GMT Subject: [code-reflection] RFR: Improved error message on OpenCLBackend if Reflect annotation is missing on transitive methods from kernel method In-Reply-To: References: Message-ID: <3p_qmjb1UN9oKpLA8yI_I6KHDuKqQy1z19C06r9QCL8=.fc830816-18de-43cb-8ac7-ce47274216c5@github.com> On Wed, 31 Dec 2025 14:06:58 GMT, Gary Frost wrote: >> hat/backends/ffi/opencl/src/main/native/cpp/opencl_backend.cpp line 223: >> >>> 221: std::cerr << "clGetBuildInfo (getting log) failed" << std::endl; >>> 222: delete[] log; >>> 223: log = nullptr; >> >> @grfrost Not sure whether this delete was really needed. >> If I understood correctly, the destructor of `OpenCLProgram` should do this anyway, hence removed. But if you think otherwise let me know. > > Will look at the delete Q. You may be correct. > > Howver, we should not defer testing this until we get to ffi/cpp native code. This is detectable in the Java side way before we get to first kernel dispatch. > > If we go down this rabit hole we are forced to also do this in the CUDA/PTX and all future ffi implementations. Agree with you that we should detect this earlier and bail out. >This is detectable in the Java side way before we get to first kernel dispatch. Since kernel method can contain call to other methods which also does not have **@Reflect** but at the same time won't run into the same issue, what criteria could we use here? I could only think of using the class name of the method as the criteria - for eg: if the class name of the method is not from jdk/hat package and if annotation is missing on that method then throw error but it seems too brittle. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/798#discussion_r2655546467 From gfrost at openjdk.org Wed Dec 31 17:10:19 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 31 Dec 2025 17:10:19 GMT Subject: git: openjdk/babylon: code-reflection: Migrated BufferTagger to use InvokeOpHelper for common tasks Message-ID: Changeset: b54c70e1 Branch: code-reflection Author: Gary Frost Date: 2025-12-31 17:08:59 +0000 URL: https://git.openjdk.org/babylon/commit/b54c70e1c317b798b85751cb9c8efbd9f1e6eab9 Migrated BufferTagger to use InvokeOpHelper for common tasks ! hat/core/src/main/java/hat/BufferTagger.java ! hat/optkl/src/main/java/optkl/InvokeOpHelper.java From gfrost at openjdk.org Wed Dec 31 17:12:36 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 31 Dec 2025 17:12:36 GMT Subject: [code-reflection] Integrated: Migrated BufferTagger to use InvokeOpHelper for common tasks Message-ID: Refactored BufferTagger to use InvokeOpHelper It's useful for common HAT style patterns, ------------- Commit messages: - Migrated BufferTagger to use InvokeOpHelper for common tasks Changes: https://git.openjdk.org/babylon/pull/800/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=800&range=00 Stats: 129 lines in 2 files changed: 42 ins; 19 del; 68 mod Patch: https://git.openjdk.org/babylon/pull/800.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/800/head:pull/800 PR: https://git.openjdk.org/babylon/pull/800 From gfrost at openjdk.org Wed Dec 31 17:12:36 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 31 Dec 2025 17:12:36 GMT Subject: [code-reflection] Integrated: Migrated BufferTagger to use InvokeOpHelper for common tasks In-Reply-To: References: Message-ID: <77GYeGLRYdcKpXs5WEO3AUFmgaXweLv4xly-NBYaFoo=.6c89baf2-f1e6-45aa-ac23-8d5b237057e5@github.com> On Wed, 31 Dec 2025 17:05:25 GMT, Gary Frost wrote: > Refactored BufferTagger to use InvokeOpHelper > > It's useful for common HAT style patterns, This pull request has now been integrated. Changeset: b54c70e1 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/b54c70e1c317b798b85751cb9c8efbd9f1e6eab9 Stats: 129 lines in 2 files changed: 42 ins; 19 del; 68 mod Migrated BufferTagger to use InvokeOpHelper for common tasks ------------- PR: https://git.openjdk.org/babylon/pull/800