From duke at openjdk.org Fri Aug 1 13:21:05 2025 From: duke at openjdk.org (Juan Fumero) Date: Fri, 1 Aug 2025 13:21:05 GMT Subject: [code-reflection] RFR: [hat][opencl] Check errors macro added Message-ID: This PR adds a new macro for controlling OpenCL errors. Notes: At the moment, the macro exits the VM if an error is encountered. In long run, what we should do is to return a state to the Java side. Thus the Java/HAT runtime can control what to do with the exception. The state can be common for all backends, at least at a high-level. Then each backend can have its own list of error status. ------------- Commit messages: - [hat][opencl] Check errors macro added Changes: https://git.openjdk.org/babylon/pull/510/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=510&range=00 Stats: 282 lines in 8 files changed: 36 ins; 58 del; 188 mod Patch: https://git.openjdk.org/babylon/pull/510.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/510/head:pull/510 PR: https://git.openjdk.org/babylon/pull/510 From duke at openjdk.org Fri Aug 1 13:27:16 2025 From: duke at openjdk.org (duke) Date: Fri, 1 Aug 2025 13:27:16 GMT Subject: [code-reflection] RFR: [hat][opencl] Check errors macro added In-Reply-To: References: Message-ID: On Fri, 1 Aug 2025 13:16:26 GMT, Juan Fumero wrote: > This PR adds a new macro for controlling OpenCL errors. > > Notes: At the moment, the macro exits the VM if an error is encountered. In long run, what we should do is to return a state to the Java side. Thus the Java/HAT runtime can control what to do with the exception. > > The state can be common for all backends, at least at a high-level. Then each backend can have its own list of error status. @jjfumero Your change (at version 5b67c75bc2df3f29242126a1b38de26e841ac362) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/510#issuecomment-3144587457 From gfrost at openjdk.org Fri Aug 1 15:24:45 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 1 Aug 2025 15:24:45 GMT Subject: git: openjdk/babylon: code-reflection: [hat][opencl] Check errors macro added Message-ID: <6083269c-6221-48c3-a042-2c66d27249c2@openjdk.org> Changeset: 9e465bb6 Branch: code-reflection Author: Juan Fumero Committer: Gary Frost Date: 2025-08-01 15:23:05 +0000 URL: https://git.openjdk.org/babylon/commit/9e465bb60c51e379fa211b1e92dc1d904239a7b2 [hat][opencl] Check errors macro added ! 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/cpp/opencl_backend_info.cpp ! hat/backends/ffi/opencl/src/main/native/cpp/opencl_backend_kernel.cpp ! hat/backends/ffi/opencl/src/main/native/cpp/opencl_backend_program.cpp ! hat/backends/ffi/opencl/src/main/native/cpp/opencl_backend_queue.cpp ! hat/backends/ffi/opencl/src/main/native/cpp/squares.cpp ! hat/backends/ffi/opencl/src/main/native/include/opencl_backend.h From duke at openjdk.org Fri Aug 1 15:26:14 2025 From: duke at openjdk.org (Juan Fumero) Date: Fri, 1 Aug 2025 15:26:14 GMT Subject: [code-reflection] Integrated: [hat][opencl] Check errors macro added In-Reply-To: References: Message-ID: On Fri, 1 Aug 2025 13:16:26 GMT, Juan Fumero wrote: > This PR adds a new macro for controlling OpenCL errors. > > Notes: At the moment, the macro exits the VM if an error is encountered. In long run, what we should do is to return a state to the Java side. Thus the Java/HAT runtime can control what to do with the exception. > > The state can be common for all backends, at least at a high-level. Then each backend can have its own list of error status. This pull request has now been integrated. Changeset: 9e465bb6 Author: Juan Fumero Committer: Gary Frost URL: https://git.openjdk.org/babylon/commit/9e465bb60c51e379fa211b1e92dc1d904239a7b2 Stats: 282 lines in 8 files changed: 36 ins; 58 del; 188 mod [hat][opencl] Check errors macro added ------------- PR: https://git.openjdk.org/babylon/pull/510 From mabbay at openjdk.org Fri Aug 1 20:47:23 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 1 Aug 2025 20:47:23 GMT Subject: [code-reflection] RFR: Disallow insertion of a root op in a block [v6] In-Reply-To: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: > A root operation shouldn't be inserted in a block. This changes enforce this rule. Mourad Abbay has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 11 commits: - Test that freezing an already bound op, throws - Test that structural quoted lambda are frozen - Update method Op.parentBlock to take into account frozen operations - Force copying of a frozen operation - Freeze code models we produce, in the OpBuilder - Merge branch 'code-reflection' into root-op-insertion - Not leak out the special Result value - Remove trace of previous attempt - Implement freezing of an op - Merge branch 'code-reflection' into root-op-insertion # Conflicts: # src/jdk.incubator.code/share/classes/jdk/incubator/code/op/CoreOp.java - ... and 1 more: https://git.openjdk.org/babylon/compare/32de7710...6e873fd4 ------------- Changes: https://git.openjdk.org/babylon/pull/425/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=05 Stats: 116 lines in 5 files changed: 112 ins; 0 del; 4 mod Patch: https://git.openjdk.org/babylon/pull/425.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/425/head:pull/425 PR: https://git.openjdk.org/babylon/pull/425 From mabbay at openjdk.org Fri Aug 1 22:07:47 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 1 Aug 2025 22:07:47 GMT Subject: [code-reflection] RFR: Disallow insertion of a root op in a block [v7] In-Reply-To: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: <2je5GvIRMgwR-6dppVH2ZNuJzN7SPn8t6LNKZHaOjO8=.3ba8dd5c-6c5c-4bfb-8658-9845c33a98dd@github.com> > A root operation shouldn't be inserted in a block. This changes enforce this rule. Mourad Abbay has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits: - Merge branch 'code-reflection' into root-op-insertion # Conflicts: # src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java # src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/OpBuilder.java - Test that freezing an already bound op, throws - Test that structural quoted lambda are frozen - Update method Op.parentBlock to take into account frozen operations - Force copying of a frozen operation - Freeze code models we produce, in the OpBuilder - Merge branch 'code-reflection' into root-op-insertion - Not leak out the special Result value - Remove trace of previous attempt - Implement freezing of an op - ... and 2 more: https://git.openjdk.org/babylon/compare/9e465bb6...e2979129 ------------- Changes: https://git.openjdk.org/babylon/pull/425/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=06 Stats: 116 lines in 5 files changed: 112 ins; 0 del; 4 mod Patch: https://git.openjdk.org/babylon/pull/425.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/425/head:pull/425 PR: https://git.openjdk.org/babylon/pull/425 From mabbay at openjdk.org Fri Aug 1 22:15:17 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 1 Aug 2025 22:15:17 GMT Subject: [code-reflection] RFR: Disallow insertion of a root op in a block [v8] In-Reply-To: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: > A root operation shouldn't be inserted in a block. This changes enforce this rule. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Update TestFreezeOp as result of API change ------------- Changes: - all: https://git.openjdk.org/babylon/pull/425/files - new: https://git.openjdk.org/babylon/pull/425/files/e2979129..46147724 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=07 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=06-07 Stats: 8 lines in 1 file changed: 0 ins; 2 del; 6 mod Patch: https://git.openjdk.org/babylon/pull/425.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/425/head:pull/425 PR: https://git.openjdk.org/babylon/pull/425 From psandoz at openjdk.org Fri Aug 1 22:44:10 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 1 Aug 2025 22:44:10 GMT Subject: git: openjdk/babylon: code-reflection: Transformation API changes Message-ID: Changeset: 20b98973 Branch: code-reflection Author: Paul Sandoz Date: 2025-08-01 22:42:43 +0000 URL: https://git.openjdk.org/babylon/commit/20b98973c2d3e453942ff34794c62b3f7027cf95 Transformation API changes ! cr-examples/onnx/src/main/java/oracle/code/onnx/compiler/OnnxTransformer.java ! cr-examples/triton/src/main/java/oracle/code/triton/TritonTransformer.java ! hat/core/src/main/java/hat/OpsAndTypes.java ! hat/examples/experiments/src/main/java/experiments/LayoutExample.java ! hat/examples/experiments/src/main/java/experiments/RawLayout.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/Block.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/Body.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/OpTransformer.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/analysis/Inliner.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/analysis/NormalizeBlocksTransformer.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/analysis/SSABraun.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/analysis/StringConcatTransformer.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/UnresolvedTypesTransformer.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java ! test/jdk/java/lang/reflect/code/CoreBinaryOpsTest.java ! test/jdk/java/lang/reflect/code/TestVarOp.java From psandoz at openjdk.org Fri Aug 1 22:45:15 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 1 Aug 2025 22:45:15 GMT Subject: [code-reflection] RFR: Transformation API changes In-Reply-To: References: Message-ID: <6Sf-gFs0_qHaR2m22bPCblbxIpQ2WEVj-SQOfH3BUdk=.aeb6721e-92ad-45e9-857d-f7b469b8324f@github.com> On Mon, 14 Jul 2025 20:47:59 GMT, Paul Sandoz wrote: > Move transformation of a `Body` starting at a `Block.Builder` to `OpTransformer`, which now has three methods, default method `acceptBody` calls default method `acceptBlock`, which in turn calls abstract method `acceptOp`. > > Simplify the body accepting methods on `Block.Builder` which now defer to `OpTransformer.acceptBody`. Those methods are responsible for rebinding the `Block.Builder` and passing the rebound result to `acceptBody`. ------------- PR Review: https://git.openjdk.org/babylon/pull/494#pullrequestreview-3080705847 From psandoz at openjdk.org Fri Aug 1 22:45:16 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 1 Aug 2025 22:45:16 GMT Subject: [code-reflection] Integrated: Transformation API changes In-Reply-To: References: Message-ID: On Mon, 14 Jul 2025 20:47:59 GMT, Paul Sandoz wrote: > Move transformation of a `Body` starting at a `Block.Builder` to `OpTransformer`, which now has three methods, default method `acceptBody` calls default method `acceptBlock`, which in turn calls abstract method `acceptOp`. > > Simplify the body accepting methods on `Block.Builder` which now defer to `OpTransformer.acceptBody`. Those methods are responsible for rebinding the `Block.Builder` and passing the rebound result to `acceptBody`. This pull request has now been integrated. Changeset: 20b98973 Author: Paul Sandoz URL: https://git.openjdk.org/babylon/commit/20b98973c2d3e453942ff34794c62b3f7027cf95 Stats: 222 lines in 16 files changed: 64 ins; 42 del; 116 mod Transformation API changes ------------- PR: https://git.openjdk.org/babylon/pull/494 From mabbay at openjdk.org Fri Aug 1 22:49:58 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 1 Aug 2025 22:49:58 GMT Subject: [code-reflection] RFR: Validate arguments types when interpreting an operation [v2] In-Reply-To: References: Message-ID: > We don't validate arguments types in the interpreter. This PR add the validation allowing us to catch invalid arguments early. 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/509/files - new: https://git.openjdk.org/babylon/pull/509/files/f140304e..641cba3b Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=509&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=509&range=00-01 Stats: 130 lines in 3 files changed: 69 ins; 56 del; 5 mod Patch: https://git.openjdk.org/babylon/pull/509.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/509/head:pull/509 PR: https://git.openjdk.org/babylon/pull/509 From mabbay at openjdk.org Fri Aug 1 23:21:03 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 1 Aug 2025 23:21:03 GMT Subject: [code-reflection] RFR: Validate arguments types when interpreting an operation [v3] In-Reply-To: References: Message-ID: > We don't validate arguments types in the interpreter. This PR add the validation allowing us to catch invalid arguments early. 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/509/files - new: https://git.openjdk.org/babylon/pull/509/files/641cba3b..b3d56672 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=509&range=02 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=509&range=01-02 Stats: 7 lines in 1 file changed: 1 ins; 0 del; 6 mod Patch: https://git.openjdk.org/babylon/pull/509.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/509/head:pull/509 PR: https://git.openjdk.org/babylon/pull/509 From gfrost at openjdk.org Sat Aug 2 12:50:40 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 2 Aug 2025 12:50:40 GMT Subject: git: openjdk/babylon: code-reflection: Add SSA id dependency viewer tool + DotViewer infra Message-ID: <84dfcd4a-1a8e-446c-b090-15ba416bed5b@openjdk.org> Changeset: 32671792 Branch: code-reflection Author: Gary Frost Date: 2025-08-02 12:49:43 +0000 URL: https://git.openjdk.org/babylon/commit/326717927244f691793cb11ffb2027c0175910a0 Add SSA id dependency viewer tool + DotViewer infra + hat/tools/src/main/java/hat/tools/jdot/DotBuilder.java + hat/tools/src/main/java/hat/tools/jdot/ui/JDot.java + hat/tools/src/main/java/hat/tools/json/Json.java + hat/tools/src/main/java/hat/tools/json/JsonArray.java + hat/tools/src/main/java/hat/tools/json/JsonBoolean.java + hat/tools/src/main/java/hat/tools/json/JsonNull.java + hat/tools/src/main/java/hat/tools/json/JsonNumber.java + hat/tools/src/main/java/hat/tools/json/JsonObject.java + hat/tools/src/main/java/hat/tools/json/JsonParseException.java + hat/tools/src/main/java/hat/tools/json/JsonString.java + hat/tools/src/main/java/hat/tools/json/JsonValue.java + hat/tools/src/main/java/hat/tools/json/impl/JsonArrayImpl.java + hat/tools/src/main/java/hat/tools/json/impl/JsonBooleanImpl.java + hat/tools/src/main/java/hat/tools/json/impl/JsonNullImpl.java + hat/tools/src/main/java/hat/tools/json/impl/JsonNumberImpl.java + hat/tools/src/main/java/hat/tools/json/impl/JsonObjectImpl.java + hat/tools/src/main/java/hat/tools/json/impl/JsonParser.java + hat/tools/src/main/java/hat/tools/json/impl/JsonStringImpl.java + hat/tools/src/main/java/hat/tools/json/impl/Utils.java ! hat/tools/src/main/java/hat/tools/textmodel/ui/AbstractTextModelViewer.java ! hat/tools/src/main/java/hat/tools/textmodel/ui/FuncOpTextModelViewer.java ! hat/tools/src/main/java/hat/tools/textmodel/ui/JavaTextModelViewer.java + hat/tools/src/main/java/hat/tools/textmodel/ui/SSAIDViewer.java ! hat/tools/src/main/java/hat/tools/textmodel/ui/TextGutter.java ! hat/tools/src/main/java/hat/tools/textmodel/ui/TextViewer.java From gfrost at openjdk.org Sat Aug 2 12:55:03 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 2 Aug 2025 12:55:03 GMT Subject: [code-reflection] Integrated: Add SSA id dependency viewer tool + DotViewer infra Message-ID: Another HAT tool that I needed to find a home for. This one shows a dependency graph between the SSA id (refs to defs) for a given Babylon funcOp graph. This is essentially a DOT graph view of the dependencies shown in the existing line based FuncOpViewer tool ------------- Commit messages: - Add SSA id dependency viewer tool + DotViewer infra Changes: https://git.openjdk.org/babylon/pull/511/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=511&range=00 Stats: 3346 lines in 25 files changed: 3259 ins; 42 del; 45 mod Patch: https://git.openjdk.org/babylon/pull/511.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/511/head:pull/511 PR: https://git.openjdk.org/babylon/pull/511 From gfrost at openjdk.org Sat Aug 2 12:55:03 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 2 Aug 2025 12:55:03 GMT Subject: [code-reflection] Integrated: Add SSA id dependency viewer tool + DotViewer infra In-Reply-To: References: Message-ID: <-KfBU4Nbbs3G6riP2KxQ5vmPQpjqbB3sF-F0jV2H1N0=.02280e19-f953-497d-a122-766ff4a84a40@github.com> On Sat, 2 Aug 2025 12:47:21 GMT, Gary Frost wrote: > Another HAT tool that I needed to find a home for. > > This one shows a dependency graph between the SSA id (refs to defs) for a given Babylon funcOp graph. > > This is essentially a DOT graph view of the dependencies shown in the existing line based FuncOpViewer tool This pull request has now been integrated. Changeset: 32671792 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/326717927244f691793cb11ffb2027c0175910a0 Stats: 3346 lines in 25 files changed: 3259 ins; 42 del; 45 mod Add SSA id dependency viewer tool + DotViewer infra ------------- PR: https://git.openjdk.org/babylon/pull/511 From psandoz at openjdk.org Sat Aug 2 14:47:09 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Sat, 2 Aug 2025 14:47:09 GMT Subject: [code-reflection] RFR: Validate arguments types when interpreting an operation [v3] In-Reply-To: References: Message-ID: On Fri, 1 Aug 2025 23:21:03 GMT, Mourad Abbay wrote: >> We don't validate arguments types in the interpreter. This PR add the validation allowing us to catch invalid arguments early. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Apply suggestions src/jdk.incubator.code/share/classes/jdk/incubator/code/interpreter/Interpreter.java line 117: > 115: Class c = typeToResolve.toNominalDescriptor().resolveConstantDesc(l); > 116: if (!c.isInstance(rv)) { > 117: Class svc = ((JavaType) sv.type()).toNominalDescriptor().resolveConstantDesc(l); You don't have to resolve here, we can just directly use `sv.type()` as an argument for the exception message. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/509#discussion_r2249269498 From mabbay at openjdk.org Mon Aug 4 16:19:34 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Mon, 4 Aug 2025 16:19:34 GMT Subject: [code-reflection] RFR: Validate arguments types when interpreting an operation [v4] In-Reply-To: References: Message-ID: > We don't validate arguments types in the interpreter. This PR add the validation allowing us to catch invalid arguments early. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Apply suggestion ------------- Changes: - all: https://git.openjdk.org/babylon/pull/509/files - new: https://git.openjdk.org/babylon/pull/509/files/b3d56672..3db706b0 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=509&range=03 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=509&range=02-03 Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/509.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/509/head:pull/509 PR: https://git.openjdk.org/babylon/pull/509 From psandoz at openjdk.org Tue Aug 5 14:21:27 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Tue, 5 Aug 2025 14:21:27 GMT Subject: [code-reflection] RFR: Validate arguments types when interpreting an operation [v4] In-Reply-To: References: Message-ID: <4_rH276gGDxL3XKrYB0lQowPIBtO-IZBLIlvOpSEjR4=.a974825f-f4a5-4716-8008-6b030b12f2d5@github.com> On Mon, 4 Aug 2025 16:19:34 GMT, Mourad Abbay wrote: >> We don't validate arguments types in the interpreter. This PR add the validation allowing us to catch invalid arguments early. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Apply suggestion Marked as reviewed by psandoz (Lead). src/jdk.incubator.code/share/classes/jdk/incubator/code/interpreter/Interpreter.java line 113: > 111: case PrimitiveType pt -> pt.box().orElseThrow(); > 112: case JavaType jt -> jt; > 113: default -> throw new IllegalStateException("Unexpected value: " + sv.type()); Suggestion: default -> throw new IllegalStateException("Unexpected type: " + sv.type()); ------------- PR Review: https://git.openjdk.org/babylon/pull/509#pullrequestreview-3088520734 PR Review Comment: https://git.openjdk.org/babylon/pull/509#discussion_r2254509313 From mabbay at openjdk.org Tue Aug 5 21:23:02 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 5 Aug 2025 21:23:02 GMT Subject: [code-reflection] RFR: Document quoteOp and quotedOp methods Message-ID: Specify the behaviour of quoteOp and quotedOp methods. ------------- Commit messages: - Document QuotedOp.quoteOp method Changes: https://git.openjdk.org/babylon/pull/512/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=00 Stats: 26 lines in 1 file changed: 25 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/512.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/512/head:pull/512 PR: https://git.openjdk.org/babylon/pull/512 From mabbay at openjdk.org Tue Aug 5 21:24:16 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 5 Aug 2025 21:24:16 GMT Subject: git: openjdk/babylon: code-reflection: Validate arguments types when interpreting an operation Message-ID: <93340d10-5a9e-4a05-9608-3e9480669ed1@openjdk.org> Changeset: 4e218910 Branch: code-reflection Author: Mourad Abbay Date: 2025-08-05 21:22:36 +0000 URL: https://git.openjdk.org/babylon/commit/4e218910f140ef6d86c2ce35278061b063846431 Validate arguments types when interpreting an operation Reviewed-by: mcimadamore, psandoz ! src/jdk.incubator.code/share/classes/jdk/incubator/code/interpreter/Interpreter.java + test/jdk/java/lang/reflect/code/interpreter/TestArgsTypesValidationWhenInterpreting.java From mabbay at openjdk.org Tue Aug 5 21:25:44 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 5 Aug 2025 21:25:44 GMT Subject: [code-reflection] Integrated: Validate arguments types when interpreting an operation In-Reply-To: References: Message-ID: On Thu, 31 Jul 2025 20:22:46 GMT, Mourad Abbay wrote: > We don't validate arguments types in the interpreter. This PR add the validation allowing us to catch invalid arguments early. This pull request has now been integrated. Changeset: 4e218910 Author: Mourad Abbay URL: https://git.openjdk.org/babylon/commit/4e218910f140ef6d86c2ce35278061b063846431 Stats: 87 lines in 2 files changed: 86 ins; 0 del; 1 mod Validate arguments types when interpreting an operation Reviewed-by: mcimadamore, psandoz ------------- PR: https://git.openjdk.org/babylon/pull/509 From mabbay at openjdk.org Tue Aug 5 21:25:43 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 5 Aug 2025 21:25:43 GMT Subject: [code-reflection] RFR: Validate arguments types when interpreting an operation [v5] In-Reply-To: References: Message-ID: <1e3m1V0T0jPSLaZJnKv1VbT7EkXMrbn7Fu12Kse8EkA=.6108a8fe-3db4-482e-bc85-ba9ddc2963f1@github.com> > We don't validate arguments types in the interpreter. This PR add the validation allowing us to catch invalid arguments early. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Apply suggestion Co-authored-by: Paul Sandoz ------------- Changes: - all: https://git.openjdk.org/babylon/pull/509/files - new: https://git.openjdk.org/babylon/pull/509/files/3db706b0..7f2b97bf Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=509&range=04 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=509&range=03-04 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/509.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/509/head:pull/509 PR: https://git.openjdk.org/babylon/pull/509 From mabbay at openjdk.org Wed Aug 6 00:02:56 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 6 Aug 2025 00:02:56 GMT Subject: [code-reflection] RFR: Document quoteOp and quotedOp methods [v2] In-Reply-To: References: Message-ID: > Specify the behaviour of quoteOp and quotedOp methods. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: When we quote an op, don't include a captured value that's an operand ------------- Changes: - all: https://git.openjdk.org/babylon/pull/512/files - new: https://git.openjdk.org/babylon/pull/512/files/0481b203..5785fab5 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=00-01 Stats: 31 lines in 2 files changed: 30 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/512.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/512/head:pull/512 PR: https://git.openjdk.org/babylon/pull/512 From mabbay at openjdk.org Wed Aug 6 00:12:12 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 6 Aug 2025 00:12:12 GMT Subject: [code-reflection] RFR: Document quoteOp and quotedOp methods [v3] In-Reply-To: References: Message-ID: <7PdnH-Eqku4oYLXlwuqyYv23fFdm8IEXEV1lGnzi5gA=.ec513f7f-2aa0-45eb-a00f-23aaf154086a@github.com> > Specify the behaviour of quoteOp and quotedOp methods. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Update quoteOp doc ------------- Changes: - all: https://git.openjdk.org/babylon/pull/512/files - new: https://git.openjdk.org/babylon/pull/512/files/5785fab5..659f018f Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=02 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=01-02 Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/512.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/512/head:pull/512 PR: https://git.openjdk.org/babylon/pull/512 From gfrost at openjdk.org Thu Aug 7 14:33:53 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 7 Aug 2025 14:33:53 GMT Subject: git: openjdk/babylon: code-reflection: HAT simplify tool text styling Message-ID: Changeset: 32995e46 Branch: code-reflection Author: Gary Frost Date: 2025-08-07 14:31:36 +0000 URL: https://git.openjdk.org/babylon/commit/32995e46dfed2b2d689c493232f1f9b70e75cf5f HAT simplify tool text styling ! hat/tools/src/main/java/hat/tools/textmodel/TextModel.java - hat/tools/src/main/java/hat/tools/textmodel/ui/AbstractTextModelViewer.java + hat/tools/src/main/java/hat/tools/textmodel/ui/BabylonStyleMapper.java ! hat/tools/src/main/java/hat/tools/textmodel/ui/ElementSpan.java ! hat/tools/src/main/java/hat/tools/textmodel/ui/FuncOpTextModelViewer.java ! hat/tools/src/main/java/hat/tools/textmodel/ui/FuncOpViewer.java ! hat/tools/src/main/java/hat/tools/textmodel/ui/JavaTextModelViewer.java ! hat/tools/src/main/java/hat/tools/textmodel/ui/SSAIDViewer.java + hat/tools/src/main/java/hat/tools/textmodel/ui/StyleMapper.java ! hat/tools/src/main/java/hat/tools/textmodel/ui/TextGutter.java + hat/tools/src/main/java/hat/tools/textmodel/ui/TextModelViewer.java - hat/tools/src/main/java/hat/tools/textmodel/ui/TextViewer.java From gfrost at openjdk.org Thu Aug 7 14:35:02 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 7 Aug 2025 14:35:02 GMT Subject: [code-reflection] Integrated: HAT simplify tool text styling Message-ID: Recent PR's have included components for styling Java and CodeReflection text. In preparation for allowing edits of text (for new upcomming tooling) I refactored the styling, so it can be reused. ------------- Commit messages: - Externalized TextModelViewer styling - Switching to external StyleMapper Changes: https://git.openjdk.org/babylon/pull/514/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=514&range=00 Stats: 902 lines in 12 files changed: 480 ins; 385 del; 37 mod Patch: https://git.openjdk.org/babylon/pull/514.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/514/head:pull/514 PR: https://git.openjdk.org/babylon/pull/514 From gfrost at openjdk.org Thu Aug 7 14:35:03 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 7 Aug 2025 14:35:03 GMT Subject: [code-reflection] Integrated: HAT simplify tool text styling In-Reply-To: References: Message-ID: On Thu, 7 Aug 2025 14:28:08 GMT, Gary Frost wrote: > Recent PR's have included components for styling Java and CodeReflection text. > > In preparation for allowing edits of text (for new upcomming tooling) I refactored the styling, so it can be reused. This pull request has now been integrated. Changeset: 32995e46 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/32995e46dfed2b2d689c493232f1f9b70e75cf5f Stats: 902 lines in 12 files changed: 480 ins; 385 del; 37 mod HAT simplify tool text styling ------------- PR: https://git.openjdk.org/babylon/pull/514 From duke at openjdk.org Thu Aug 7 15:27:53 2025 From: duke at openjdk.org (Juan Fumero) Date: Thu, 7 Aug 2025 15:27:53 GMT Subject: [code-reflection] RFR: [hat] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges Message-ID: This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. How to dispatch 1D kernels? ComputeRange range1D = new ComputeRange(new ThreadMesh(size)); cc.dispatchKernel(computeRange, kc -> myKernel(...)); How to dispatch 2D kernels? ComputeRange range2D = new ComputeRange(new ThreadMesh(size, size)); cc.dispatchKernel(computeRange, kc -> my2DKernel(...)); How to enable local mesh? We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. ComputeRange computeRange = new ComputeRange( new ThreadMesh(globalSize, globalSize), new ThreadMesh(16, 16)); cc.dispatchKernel(computeRange, kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) ); In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. #### How to check? java @hat/run ffi-opencl matmul 1D java @hat/run ffi-opencl matmul 2D java @hat/run ffi-cuda matmul 1D java @hat/run ffi-cuda matmul 2D ------------- Commit messages: - Merge branch 'code-reflection' into hat/api/lw - [hat] ComputeRange enable for the CUDA Runtime - [hat][example] Fix arguments for compute context - [hat] ComputeRange/ThreadMesh proposal for OpenCL Changes: https://git.openjdk.org/babylon/pull/515/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=515&range=00 Stats: 639 lines in 37 files changed: 396 ins; 161 del; 82 mod Patch: https://git.openjdk.org/babylon/pull/515.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/515/head:pull/515 PR: https://git.openjdk.org/babylon/pull/515 From duke at openjdk.org Thu Aug 7 15:32:58 2025 From: duke at openjdk.org (Juan Fumero) Date: Thu, 7 Aug 2025 15:32:58 GMT Subject: [code-reflection] RFR: [hat] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges [v2] In-Reply-To: References: Message-ID: > This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. > A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. > > Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. > > How to dispatch 1D kernels? > > > ComputeRange range1D = new ComputeRange(new ThreadMesh(size)); > cc.dispatchKernel(computeRange, > kc -> myKernel(...)); > > > How to dispatch 2D kernels? > > > ComputeRange range2D = new ComputeRange(new ThreadMesh(size, size)); > cc.dispatchKernel(computeRange, > kc -> my2DKernel(...)); > > > How to enable local mesh? > > We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. > > > ComputeRange computeRange = new ComputeRange( > new ThreadMesh(globalSize, globalSize), > new ThreadMesh(16, 16)); > cc.dispatchKernel(computeRange, > kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) > ); > > > In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. > > > #### How to check? > > > java @hat/run ffi-opencl matmul 1D > java @hat/run ffi-opencl matmul 2D > > java @hat/run ffi-cuda matmul 1D > java @hat/run ffi-cuda matmul 2D Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: minor change ------------- Changes: - all: https://git.openjdk.org/babylon/pull/515/files - new: https://git.openjdk.org/babylon/pull/515/files/257ff1de..51efd2c2 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=515&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=515&range=00-01 Stats: 2 lines in 1 file changed: 0 ins; 2 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/515.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/515/head:pull/515 PR: https://git.openjdk.org/babylon/pull/515 From duke at openjdk.org Fri Aug 8 07:58:37 2025 From: duke at openjdk.org (duke) Date: Fri, 8 Aug 2025 07:58:37 GMT Subject: [code-reflection] RFR: [hat] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges [v2] In-Reply-To: References: Message-ID: On Thu, 7 Aug 2025 15:32:58 GMT, Juan Fumero wrote: >> This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. >> A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. >> >> Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. >> >> How to dispatch 1D kernels? >> >> >> ComputeRange range1D = new ComputeRange(new ThreadMesh(size)); >> cc.dispatchKernel(computeRange, >> kc -> myKernel(...)); >> >> >> How to dispatch 2D kernels? >> >> >> ComputeRange range2D = new ComputeRange(new ThreadMesh(size, size)); >> cc.dispatchKernel(computeRange, >> kc -> my2DKernel(...)); >> >> >> How to enable local mesh? >> >> We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. >> >> >> ComputeRange computeRange = new ComputeRange( >> new ThreadMesh(globalSize, globalSize), >> new ThreadMesh(16, 16)); >> cc.dispatchKernel(computeRange, >> kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) >> ); >> >> >> In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. >> >> >> #### How to check? >> >> >> java @hat/run ffi-opencl matmul 1D >> java @hat/run ffi-opencl matmul 2D >> >> java @hat/run ffi-cuda matmul 1D >> java @hat/run ffi-cuda matmul 2D > > Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: > > minor change @jjfumero Your change (at version 51efd2c2085b0ee9a17423258615c5872d75c6fc) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/515#issuecomment-3166913943 From duke at openjdk.org Fri Aug 8 09:20:41 2025 From: duke at openjdk.org (Juan Fumero) Date: Fri, 8 Aug 2025 09:20:41 GMT Subject: [code-reflection] RFR: New example suite for code reflection Message-ID: New example suite for code reflection. It includes two programs that illustrate different functionality of the code reflection API. ### How to build? This module is built using the code-reflection fork of OpenJDK. Then, update the `JAVA_HOME` to point to the code-reflection port, and compile with maven. In detail: #### 1. Build Babylon JDK We need to use the JDK build that enables the code reflection API (Babylon). git clone https://github.com/openjdk/babylon cd babylon bash configure --with-boot-jdk=${JAVA_HOME} Then, we use the built JDK as `JAVA_HOME` export JAVA_HOME=/$HOME/repos/babylon/build/macosx-aarch64-server-release/jdk/ export PATH=$JAVA_HOME/bin:$PATH #### 2. Build the example suite mvn clean package #### 3. Run the examples ##### Run HelloCodeReflection java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.HelloCodeReflection ##### Run MathOptimizer java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizer More example to appear in this module. ------------- Commit messages: - minor cleanup - Merge branch 'code-reflection' into cr/examples/suite - trim spaces - [samples] Analysis of parameters simplified - Remove scripts for build and run - New example suite for code reflection Changes: https://git.openjdk.org/babylon/pull/513/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=513&range=00 Stats: 534 lines in 4 files changed: 534 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/513.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/513/head:pull/513 PR: https://git.openjdk.org/babylon/pull/513 From duke at openjdk.org Fri Aug 8 09:42:41 2025 From: duke at openjdk.org (duke) Date: Fri, 8 Aug 2025 09:42:41 GMT Subject: [code-reflection] RFR: New example suite for code reflection In-Reply-To: References: Message-ID: On Wed, 6 Aug 2025 10:39:43 GMT, Juan Fumero wrote: > New example suite for code reflection. It includes two programs that illustrate different functionality of the code reflection API. > > ### How to build? > > This module is built using the code-reflection fork of OpenJDK. Then, update the `JAVA_HOME` to point to the code-reflection port, and compile with maven. In detail: > > #### 1. Build Babylon JDK > > We need to use the JDK build that enables the code reflection API (Babylon). > > > git clone https://github.com/openjdk/babylon > cd babylon > bash configure --with-boot-jdk=${JAVA_HOME} > > > Then, we use the built JDK as `JAVA_HOME` > > > export JAVA_HOME=/$HOME/repos/babylon/build/macosx-aarch64-server-release/jdk/ > export PATH=$JAVA_HOME/bin:$PATH > > > #### 2. Build the example suite > > > mvn clean package > > > #### 3. Run the examples > > ##### Run HelloCodeReflection > > > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.HelloCodeReflection > > > ##### Run MathOptimizer > > > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizer > > > More example to appear in this module. @jjfumero Your change (at version 49f5ef90f4c2da613332fe84a620a4ea64ec6764) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/513#issuecomment-3167229200 From duke at openjdk.org Fri Aug 8 14:04:40 2025 From: duke at openjdk.org (Juan Fumero) Date: Fri, 8 Aug 2025 14:04:40 GMT Subject: [code-reflection] Withdrawn: [hat] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges In-Reply-To: References: Message-ID: On Thu, 7 Aug 2025 15:20:29 GMT, Juan Fumero wrote: > This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. > A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. > > Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. > > How to dispatch 1D kernels? > > > ComputeRange range1D = new ComputeRange(new ThreadMesh(size)); > cc.dispatchKernel(computeRange, > kc -> myKernel(...)); > > > How to dispatch 2D kernels? > > > ComputeRange range2D = new ComputeRange(new ThreadMesh(size, size)); > cc.dispatchKernel(computeRange, > kc -> my2DKernel(...)); > > > How to enable local mesh? > > We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. > > > ComputeRange computeRange = new ComputeRange( > new ThreadMesh(globalSize, globalSize), > new ThreadMesh(16, 16)); > cc.dispatchKernel(computeRange, > kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) > ); > > > In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. > > > #### How to check? > > > java @hat/run ffi-opencl matmul 1D > java @hat/run ffi-opencl matmul 2D > > java @hat/run ffi-cuda matmul 1D > java @hat/run ffi-cuda matmul 2D This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/babylon/pull/515 From psandoz at openjdk.org Fri Aug 8 14:52:31 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 8 Aug 2025 14:52:31 GMT Subject: [code-reflection] RFR: New example suite for code reflection In-Reply-To: References: Message-ID: On Wed, 6 Aug 2025 10:39:43 GMT, Juan Fumero wrote: > New example suite for code reflection. It includes two programs that illustrate different functionality of the code reflection API. > > ### How to build? > > This module is built using the code-reflection fork of OpenJDK. Then, update the `JAVA_HOME` to point to the code-reflection port, and compile with maven. In detail: > > #### 1. Build Babylon JDK > > We need to use the JDK build that enables the code reflection API (Babylon). > > > git clone https://github.com/openjdk/babylon > cd babylon > bash configure --with-boot-jdk=${JAVA_HOME} > > > Then, we use the built JDK as `JAVA_HOME` > > > export JAVA_HOME=/$HOME/repos/babylon/build/macosx-aarch64-server-release/jdk/ > export PATH=$JAVA_HOME/bin:$PATH > > > #### 2. Build the example suite > > > mvn clean package > > > #### 3. Run the examples > > ##### Run HelloCodeReflection > > > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.HelloCodeReflection > > > ##### Run MathOptimizer > > > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizer > > > More example to appear in this module. Looks good just one minor comment inline you could address now or later up to you. In subsequent PRs we could add more examples e.g., taken from say [`TestLocalTransformationsAdaption` ](https://github.com/openjdk/babylon/blob/code-reflection/test/jdk/java/lang/reflect/code/TestLocalTransformationsAdaption.java ) cr-examples/samples/src/main/java/oracle/code/samples/MathOptimizer.java line 87: > 85: > 86: // if pow(x, 2) then substitute for this function > 87: private static double functionMult(double x) { A more complex example to consider later after this PR would be to make these methods reflectable, and then you can inline these methods into the transformed model so `Math.pow` is substituted with direct expressions. cr-examples/samples/src/main/java/oracle/code/samples/MathOptimizer.java line 129: > 127: case JavaOp.InvokeOp invokeOp when whenIsMathPowFunction(invokeOp) -> { > 128: // The idea here is to create a new JavaOp.invoke with the optimization and replace it. > 129: List operands = blockBuilder.context().getValues(op.operands()); Strictly speaking `operands` are the _output_ operands of values in output model we are building. We get them from the _input_ operands, values in the input model. This works because the transformation has already mapped those input values to output values, since it already encountered them (when copying of the func op and its parameters). cr-examples/samples/src/main/java/oracle/code/samples/MathOptimizer.java line 176: > 174: // invoke function. > 175: List newOperandList2 = new ArrayList<>(); > 176: newOperandList2.add(operands.get(0)); You don't need to create list (or a sub list). The `Java.invoke` method is overloaded to accept a var args or a list. In this case we can use the former and just pass `operands.get(0)` directly, or more clearly `operands.getFirst()`. cr-examples/samples/src/main/java/oracle/code/samples/MathOptimizer.java line 260: > 258: > 259: // Inspect a value for a parameter > 260: static boolean inspectParameterRecursive(JavaOp.ConvOp convOp, int valToMatch) { At some point we will get better at pattern matching, we need the language enhancements for pattern matching. In the interim see the experiment in `jdk.incubator.code.analysis.Patterns` and its use [here](https://github.com/openjdk/babylon/blob/code-reflection/test/jdk/java/lang/reflect/code/ad/ExpressionElimination.java#L58). Not suggesting you use it here, just for information which you might find interesting. ------------- Marked as reviewed by psandoz (Lead). PR Review: https://git.openjdk.org/babylon/pull/513#pullrequestreview-3101083514 PR Review Comment: https://git.openjdk.org/babylon/pull/513#discussion_r2263169163 PR Review Comment: https://git.openjdk.org/babylon/pull/513#discussion_r2263177769 PR Review Comment: https://git.openjdk.org/babylon/pull/513#discussion_r2263159978 PR Review Comment: https://git.openjdk.org/babylon/pull/513#discussion_r2263189072 From duke at openjdk.org Fri Aug 8 15:04:36 2025 From: duke at openjdk.org (Juan Fumero) Date: Fri, 8 Aug 2025 15:04:36 GMT Subject: [code-reflection] RFR: New example suite for code reflection In-Reply-To: References: Message-ID: <9a7sPcNuuf9k-hO3BOGpTIYXXfZCps-5n2zO_wSmw4o=.42fd7d08-7e35-4ada-ba95-6be60aa31d64@github.com> On Fri, 8 Aug 2025 14:38:13 GMT, Paul Sandoz wrote: >> New example suite for code reflection. It includes two programs that illustrate different functionality of the code reflection API. >> >> ### How to build? >> >> This module is built using the code-reflection fork of OpenJDK. Then, update the `JAVA_HOME` to point to the code-reflection port, and compile with maven. In detail: >> >> #### 1. Build Babylon JDK >> >> We need to use the JDK build that enables the code reflection API (Babylon). >> >> >> git clone https://github.com/openjdk/babylon >> cd babylon >> bash configure --with-boot-jdk=${JAVA_HOME} >> >> >> Then, we use the built JDK as `JAVA_HOME` >> >> >> export JAVA_HOME=/$HOME/repos/babylon/build/macosx-aarch64-server-release/jdk/ >> export PATH=$JAVA_HOME/bin:$PATH >> >> >> #### 2. Build the example suite >> >> >> mvn clean package >> >> >> #### 3. Run the examples >> >> ##### Run HelloCodeReflection >> >> >> java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.HelloCodeReflection >> >> >> ##### Run MathOptimizer >> >> >> java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizer >> >> >> More example to appear in this module. > > cr-examples/samples/src/main/java/oracle/code/samples/MathOptimizer.java line 87: > >> 85: >> 86: // if pow(x, 2) then substitute for this function >> 87: private static double functionMult(double x) { > > A more complex example to consider later after this PR would be to make these methods reflectable, and then you can inline these methods into the transformed model so `Math.pow` is substituted with direct expressions. This looks a nice follow up example. I will take a look after this PR. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/513#discussion_r2263222271 From mabbay at openjdk.org Fri Aug 8 18:40:43 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 8 Aug 2025 18:40:43 GMT Subject: [code-reflection] RFR: Document quoteOp and quotedOp methods [v4] In-Reply-To: References: Message-ID: > Specify the behaviour of quoteOp and quotedOp methods. Mourad Abbay has updated the pull request incrementally with three additional commits since the last revision: - Update comment - Comment on the validation of block params and ConstantOp results - Document Quoted.quotedOp ------------- Changes: - all: https://git.openjdk.org/babylon/pull/512/files - new: https://git.openjdk.org/babylon/pull/512/files/659f018f..e75f36f9 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=03 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=02-03 Stats: 29 lines in 1 file changed: 21 ins; 0 del; 8 mod Patch: https://git.openjdk.org/babylon/pull/512.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/512/head:pull/512 PR: https://git.openjdk.org/babylon/pull/512 From mabbay at openjdk.org Fri Aug 8 19:01:12 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 8 Aug 2025 19:01:12 GMT Subject: [code-reflection] RFR: Document quoteOp and quotedOp methods [v5] In-Reply-To: References: Message-ID: > Specify the behaviour of quoteOp and quotedOp methods. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Add negative test cases ------------- Changes: - all: https://git.openjdk.org/babylon/pull/512/files - new: https://git.openjdk.org/babylon/pull/512/files/e75f36f9..1781cdb0 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=04 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=03-04 Stats: 31 lines in 1 file changed: 31 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/512.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/512/head:pull/512 PR: https://git.openjdk.org/babylon/pull/512 From mabbay at openjdk.org Fri Aug 8 19:07:07 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 8 Aug 2025 19:07:07 GMT Subject: [code-reflection] RFR: Document quoteOp and quotedOp methods [v6] In-Reply-To: References: Message-ID: > Specify the behaviour of quoteOp and quotedOp methods. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Rectify the validation logic ------------- Changes: - all: https://git.openjdk.org/babylon/pull/512/files - new: https://git.openjdk.org/babylon/pull/512/files/1781cdb0..1fcefbcf Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=05 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=04-05 Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.org/babylon/pull/512.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/512/head:pull/512 PR: https://git.openjdk.org/babylon/pull/512 From duke at openjdk.org Mon Aug 11 09:04:47 2025 From: duke at openjdk.org (Juan Fumero) Date: Mon, 11 Aug 2025 09:04:47 GMT Subject: [code-reflection] RFR: New example suite for code reflection [v2] In-Reply-To: References: Message-ID: > New example suite for code reflection. It includes two programs that illustrate different functionality of the code reflection API. > > ### How to build? > > This module is built using the code-reflection fork of OpenJDK. Then, update the `JAVA_HOME` to point to the code-reflection port, and compile with maven. In detail: > > #### 1. Build Babylon JDK > > We need to use the JDK build that enables the code reflection API (Babylon). > > > git clone https://github.com/openjdk/babylon > cd babylon > bash configure --with-boot-jdk=${JAVA_HOME} > > > Then, we use the built JDK as `JAVA_HOME` > > > export JAVA_HOME=/$HOME/repos/babylon/build/macosx-aarch64-server-release/jdk/ > export PATH=$JAVA_HOME/bin:$PATH > > > #### 2. Build the example suite > > > mvn clean package > > > #### 3. Run the examples > > ##### Run HelloCodeReflection > > > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.HelloCodeReflection > > > ##### Run MathOptimizer > > > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizer > > > More example to appear in this module. Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: [samples] Example suite fixed with commets from PR#513 ------------- Changes: - all: https://git.openjdk.org/babylon/pull/513/files - new: https://git.openjdk.org/babylon/pull/513/files/49f5ef90..7ca5d4f8 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=513&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=513&range=00-01 Stats: 7 lines in 1 file changed: 0 ins; 5 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/513.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/513/head:pull/513 PR: https://git.openjdk.org/babylon/pull/513 From duke at openjdk.org Mon Aug 11 09:56:24 2025 From: duke at openjdk.org (Juan Fumero) Date: Mon, 11 Aug 2025 09:56:24 GMT Subject: [code-reflection] RFR: [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges Message-ID: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. How to dispatch 1D kernels? ComputeRange range1D = new ComputeRange(new ThreadMesh1D(size)); cc.dispatchKernel(range1D, kc -> myKernel(...)); How to dispatch 2D kernels? ComputeRange range2D = new ComputeRange(new ThreadMesh2D(size, size)); cc.dispatchKernel(range2D, kc -> my2DKernel(...)); How to enable local mesh? We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. ComputeRange computeRange = new ComputeRange( new ThreadMesh2D(globalSize, globalSize), new ThreadMesh2D(16, 16)); cc.dispatchKernel(computeRange, kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) ); In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. #### How to check? java @hat/run ffi-opencl matmul 1D java @hat/run ffi-opencl matmul 2D java @hat/run ffi-cuda matmul 1D java @hat/run ffi-cuda matmul 2D ------------- Commit messages: - [hat] Javadoc for the rest of the ComputeRange Class - [hat] Add threadmesh subtyping to keep consistency accross dimensions between global and local - [hat] ThreadBlock dispatcher enabled for the CUDA backend - [hat][api] Proposal for ComputeRange and ThreadMesh Changes: https://git.openjdk.org/babylon/pull/516/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=516&range=00 Stats: 639 lines in 18 files changed: 507 ins; 97 del; 35 mod Patch: https://git.openjdk.org/babylon/pull/516.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/516/head:pull/516 PR: https://git.openjdk.org/babylon/pull/516 From duke at openjdk.org Mon Aug 11 09:56:24 2025 From: duke at openjdk.org (Juan Fumero) Date: Mon, 11 Aug 2025 09:56:24 GMT Subject: [code-reflection] RFR: [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges In-Reply-To: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> References: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> Message-ID: On Fri, 8 Aug 2025 14:00:23 GMT, Juan Fumero wrote: > This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. > A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. > > Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. > > How to dispatch 1D kernels? > > > ComputeRange range1D = new ComputeRange(new ThreadMesh1D(size)); > cc.dispatchKernel(range1D, > kc -> myKernel(...)); > > > How to dispatch 2D kernels? > > > ComputeRange range2D = new ComputeRange(new ThreadMesh2D(size, size)); > cc.dispatchKernel(range2D, > kc -> my2DKernel(...)); > > > How to enable local mesh? > > We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. > > > ComputeRange computeRange = new ComputeRange( > new ThreadMesh2D(globalSize, globalSize), > new ThreadMesh2D(16, 16)); > cc.dispatchKernel(computeRange, > kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) > ); > > > In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. > > > #### How to check? > > > java @hat/run ffi-opencl matmul 1D > java @hat/run ffi-opencl matmul 2D > > java @hat/run ffi-cuda matmul 1D > java @hat/run ffi-cuda matmul 2D This PR is ready for review ------------- PR Comment: https://git.openjdk.org/babylon/pull/516#issuecomment-3173999163 From duke at openjdk.org Mon Aug 11 09:56:25 2025 From: duke at openjdk.org (duke) Date: Mon, 11 Aug 2025 09:56:25 GMT Subject: [code-reflection] RFR: [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges In-Reply-To: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> References: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> Message-ID: On Fri, 8 Aug 2025 14:00:23 GMT, Juan Fumero wrote: > This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. > A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. > > Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. > > How to dispatch 1D kernels? > > > ComputeRange range1D = new ComputeRange(new ThreadMesh1D(size)); > cc.dispatchKernel(range1D, > kc -> myKernel(...)); > > > How to dispatch 2D kernels? > > > ComputeRange range2D = new ComputeRange(new ThreadMesh2D(size, size)); > cc.dispatchKernel(range2D, > kc -> my2DKernel(...)); > > > How to enable local mesh? > > We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. > > > ComputeRange computeRange = new ComputeRange( > new ThreadMesh2D(globalSize, globalSize), > new ThreadMesh2D(16, 16)); > cc.dispatchKernel(computeRange, > kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) > ); > > > In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. > > > #### How to check? > > > java @hat/run ffi-opencl matmul 1D > java @hat/run ffi-opencl matmul 2D > > java @hat/run ffi-cuda matmul 1D > java @hat/run ffi-cuda matmul 2D @jjfumero Your change (at version 6cdb52fffb1fd56fbcd65e86fd8a88ddfe180671) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/516#issuecomment-3174007745 From psandoz at openjdk.org Mon Aug 11 16:02:33 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Mon, 11 Aug 2025 16:02:33 GMT Subject: [code-reflection] RFR: New example suite for code reflection [v2] In-Reply-To: References: Message-ID: On Mon, 11 Aug 2025 09:04:47 GMT, Juan Fumero wrote: >> New example suite for code reflection. It includes two programs that illustrate different functionality of the code reflection API. >> >> ### How to build? >> >> This module is built using the code-reflection fork of OpenJDK. Then, update the `JAVA_HOME` to point to the code-reflection port, and compile with maven. In detail: >> >> #### 1. Build Babylon JDK >> >> We need to use the JDK build that enables the code reflection API (Babylon). >> >> >> git clone https://github.com/openjdk/babylon >> cd babylon >> bash configure --with-boot-jdk=${JAVA_HOME} >> >> >> Then, we use the built JDK as `JAVA_HOME` >> >> >> export JAVA_HOME=/$HOME/repos/babylon/build/macosx-aarch64-server-release/jdk/ >> export PATH=$JAVA_HOME/bin:$PATH >> >> >> #### 2. Build the example suite >> >> >> mvn clean package >> >> >> #### 3. Run the examples >> >> ##### Run HelloCodeReflection >> >> >> java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.HelloCodeReflection >> >> >> ##### Run MathOptimizer >> >> >> java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizer >> >> >> More example to appear in this module. > > Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: > > [samples] Example suite fixed with commets from PR#513 Marked as reviewed by psandoz (Lead). ------------- PR Review: https://git.openjdk.org/babylon/pull/513#pullrequestreview-3106572567 From duke at openjdk.org Tue Aug 12 06:49:34 2025 From: duke at openjdk.org (duke) Date: Tue, 12 Aug 2025 06:49:34 GMT Subject: [code-reflection] RFR: New example suite for code reflection [v2] In-Reply-To: References: Message-ID: On Mon, 11 Aug 2025 09:04:47 GMT, Juan Fumero wrote: >> New example suite for code reflection. It includes two programs that illustrate different functionality of the code reflection API. >> >> ### How to build? >> >> This module is built using the code-reflection fork of OpenJDK. Then, update the `JAVA_HOME` to point to the code-reflection port, and compile with maven. In detail: >> >> #### 1. Build Babylon JDK >> >> We need to use the JDK build that enables the code reflection API (Babylon). >> >> >> git clone https://github.com/openjdk/babylon >> cd babylon >> bash configure --with-boot-jdk=${JAVA_HOME} >> >> >> Then, we use the built JDK as `JAVA_HOME` >> >> >> export JAVA_HOME=/$HOME/repos/babylon/build/macosx-aarch64-server-release/jdk/ >> export PATH=$JAVA_HOME/bin:$PATH >> >> >> #### 2. Build the example suite >> >> >> mvn clean package >> >> >> #### 3. Run the examples >> >> ##### Run HelloCodeReflection >> >> >> java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.HelloCodeReflection >> >> >> ##### Run MathOptimizer >> >> >> java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizer >> >> >> More example to appear in this module. > > Juan Fumero has updated the pull request incrementally with one additional commit since the last revision: > > [samples] Example suite fixed with commets from PR#513 @jjfumero Your change (at version 7ca5d4f8dd6c20cbd95e9317ce9f09bfec016c88) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/513#issuecomment-3177927193 From duke at openjdk.org Tue Aug 12 07:25:46 2025 From: duke at openjdk.org (Juan Fumero) Date: Tue, 12 Aug 2025 07:25:46 GMT Subject: [code-reflection] RFR: [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges [v2] In-Reply-To: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> References: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> Message-ID: > This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. > A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. > > Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. > > How to dispatch 1D kernels? > > > ComputeRange range1D = new ComputeRange(new GlobalMesh1D(size)); > cc.dispatchKernel(range1D, > kc -> myKernel(...)); > > > How to dispatch 2D kernels? > > > ComputeRange range2D = new ComputeRange(new GlobalMesh2D(size, size)); > cc.dispatchKernel(range2D, > kc -> my2DKernel(...)); > > > How to enable local mesh? > > We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. > > > ComputeRange computeRange = new ComputeRange( > new GlobalMesh2D(globalSize, globalSize), > new LocalMesh2D(16, 16)); > cc.dispatchKernel(computeRange, > kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) > ); > > > In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. > > > #### How to check? > > > java @hat/run ffi-opencl matmul 1D > java @hat/run ffi-opencl matmul 2D > > java @hat/run ffi-cuda matmul 1D > java @hat/run ffi-cuda matmul 2D Juan Fumero has updated the pull request incrementally with five additional commits since the last revision: - [hat] BuildCallGraph refactored - [hat] Improve logging for thread-mesh in OpenCL - [hat][cuda] 1D to 3D mesh refactored for the CUDA Backend - [hat] ThreadMesh Buffer composed with iFace to set global and local thread-mesh - [hat][api] ThreadMesh moved to records implementation ------------- Changes: - all: https://git.openjdk.org/babylon/pull/516/files - new: https://git.openjdk.org/babylon/pull/516/files/6cdb52ff..438537da Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=516&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=516&range=00-01 Stats: 654 lines in 22 files changed: 344 ins; 201 del; 109 mod Patch: https://git.openjdk.org/babylon/pull/516.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/516/head:pull/516 PR: https://git.openjdk.org/babylon/pull/516 From duke at openjdk.org Tue Aug 12 07:25:46 2025 From: duke at openjdk.org (Juan Fumero) Date: Tue, 12 Aug 2025 07:25:46 GMT Subject: [code-reflection] RFR: [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges In-Reply-To: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> References: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> Message-ID: <1CjWbNt7ea_4W8S_BvYb3jLO-U59ArFBxtDmGkho4a4=.366061d5-b077-4a67-a2d2-ab467494b72c@github.com> On Fri, 8 Aug 2025 14:00:23 GMT, Juan Fumero wrote: > This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. > A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. > > Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. > > How to dispatch 1D kernels? > > > ComputeRange range1D = new ComputeRange(new GlobalMesh1D(size)); > cc.dispatchKernel(range1D, > kc -> myKernel(...)); > > > How to dispatch 2D kernels? > > > ComputeRange range2D = new ComputeRange(new GlobalMesh2D(size, size)); > cc.dispatchKernel(range2D, > kc -> my2DKernel(...)); > > > How to enable local mesh? > > We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. > > > ComputeRange computeRange = new ComputeRange( > new GlobalMesh2D(globalSize, globalSize), > new LocalMesh2D(16, 16)); > cc.dispatchKernel(computeRange, > kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) > ); > > > In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. > > > #### How to check? > > > java @hat/run ffi-opencl matmul 1D > java @hat/run ffi-opencl matmul 2D > > java @hat/run ffi-cuda matmul 1D > java @hat/run ffi-cuda matmul 2D After some meetings, I moved this PR to a draft. Refining the internal interfaces for representing NDRanges. ------------- PR Comment: https://git.openjdk.org/babylon/pull/516#issuecomment-3174586571 From duke at openjdk.org Tue Aug 12 07:25:46 2025 From: duke at openjdk.org (duke) Date: Tue, 12 Aug 2025 07:25:46 GMT Subject: [code-reflection] RFR: [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges In-Reply-To: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> References: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> Message-ID: On Fri, 8 Aug 2025 14:00:23 GMT, Juan Fumero wrote: > This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. > A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. > > Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. > > How to dispatch 1D kernels? > > > ComputeRange range1D = new ComputeRange(new GlobalMesh1D(size)); > cc.dispatchKernel(range1D, > kc -> myKernel(...)); > > > How to dispatch 2D kernels? > > > ComputeRange range2D = new ComputeRange(new GlobalMesh2D(size, size)); > cc.dispatchKernel(range2D, > kc -> my2DKernel(...)); > > > How to enable local mesh? > > We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. > > > ComputeRange computeRange = new ComputeRange( > new GlobalMesh2D(globalSize, globalSize), > new LocalMesh2D(16, 16)); > cc.dispatchKernel(computeRange, > kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) > ); > > > In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. > > > #### How to check? > > > java @hat/run ffi-opencl matmul 1D > java @hat/run ffi-opencl matmul 2D > > java @hat/run ffi-cuda matmul 1D > java @hat/run ffi-cuda matmul 2D @jjfumero Your change (at version 438537dae41b36504089964c73e8686f4d81bf40) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/516#issuecomment-3178029933 From duke at openjdk.org Tue Aug 12 10:03:41 2025 From: duke at openjdk.org (Juan Fumero) Date: Tue, 12 Aug 2025 10:03:41 GMT Subject: [code-reflection] RFR: [fix][hat] Codegen fixed when passing the kernel context to multiple invoke functions Message-ID: This PR fixes the code generator when passing the `kernelContext` object to new invoke functions within the main compute kernel. Code like this: ```java @CodeReflection public static float compute(@RO KernelContext kc, @RO F32Array matrixA, @RO F32Array matrixB, int size, int j) { float acc = 0; for (int k = 0; k < size; k++) { acc += (matrixA.array(kc.x * size + k) * matrixB.array(k * size + j)); } return acc; } @CodeReflection public static void matrixMultiplyKernel1D(@RO KernelContext kc, @RO F32Array matrixA, @RO F32Array matrixB, @RW F32Array matrixC, int size) { if (kc.x < kc.maxX) { for (int j = 0; j < size; j++) { float acc = compute(kc, matrixA, matrixB, size, j); matrixC.array(kc.x * size + j, acc); } } } Generated the following error when compiling the kernel: UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed buildStatus =failed logLen = 1993 log = program_source:33:5: error: unknown type name 'hat' hat.KernelContext kc, __global F32Array_t* matrixA, __global F32Array_t* matrixB, int size, int j ^ This is due to the wrong naming from the `kernelContext` when it gets compiled to OpenCL or CUDA. This PR patches this by checking the argument type and replacing with the appropriate CUDA/OpenCL struct. ### How to check? HAT=INFO,SHOW_CODE java @hat/run ffi-opencl matmul 1DFC This patch has been tested for both the OpenCL and the CUDA HAT Backends. ------------- Commit messages: - Add todo for checking param types in HAT - [fix][hat] Codegen fixed when passing the kernel context to multple inner function calls Changes: https://git.openjdk.org/babylon/pull/519/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=519&range=00 Stats: 50 lines in 2 files changed: 46 ins; 0 del; 4 mod Patch: https://git.openjdk.org/babylon/pull/519.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/519/head:pull/519 PR: https://git.openjdk.org/babylon/pull/519 From duke at openjdk.org Tue Aug 12 10:03:41 2025 From: duke at openjdk.org (duke) Date: Tue, 12 Aug 2025 10:03:41 GMT Subject: [code-reflection] RFR: [fix][hat] Codegen fixed when passing the kernel context to multiple invoke functions In-Reply-To: References: Message-ID: On Tue, 12 Aug 2025 09:56:00 GMT, Juan Fumero wrote: > This PR fixes the code generator when passing the `kernelContext` object to new invoke functions within the main compute kernel. > > Code like this: > ```java > @CodeReflection > public static float compute(@RO KernelContext kc, @RO F32Array matrixA, @RO F32Array matrixB, int size, int j) { > float acc = 0; > for (int k = 0; k < size; k++) { > acc += (matrixA.array(kc.x * size + k) * matrixB.array(k * size + j)); > } > return acc; > } > > @CodeReflection > public static void matrixMultiplyKernel1D(@RO KernelContext kc, @RO F32Array matrixA, @RO F32Array matrixB, @RW F32Array matrixC, int size) { > if (kc.x < kc.maxX) { > for (int j = 0; j < size; j++) { > float acc = compute(kc, matrixA, matrixB, size, j); > matrixC.array(kc.x * size + j, acc); > } > } > } > > > Generated the following error when compiling the kernel: > > > UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed > buildStatus =failed > logLen = 1993 log = program_source:33:5: error: unknown type name 'hat' > hat.KernelContext kc, __global F32Array_t* matrixA, __global F32Array_t* matrixB, int size, int j > ^ > > > This is due to the wrong naming from the `kernelContext` when it gets compiled to OpenCL or CUDA. > This PR patches this by checking the argument type and replacing with the appropriate CUDA/OpenCL struct. > > ### How to check? > > > HAT=INFO,SHOW_CODE java @hat/run ffi-opencl matmul 1DFC > > > This patch has been tested for both the OpenCL and the CUDA HAT Backends. @jjfumero Your change (at version ea9a7bf815001a618fa742a7dfe10c876b83885c) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/519#issuecomment-3178657528 From gfrost at openjdk.org Tue Aug 12 10:31:36 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 12 Aug 2025 10:31:36 GMT Subject: [code-reflection] Integrated: HAT remove trailing eol ws from pom.xml files Message-ID: Extended sanity check to include pom.xml files which detected trailing eol ws in pom files ------------- Commit messages: - Removed trailing eol ws from pom.xml files - ModuleOp support for HAT CallGraph Changes: https://git.openjdk.org/babylon/pull/520/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=520&range=00 Stats: 274 lines in 15 files changed: 151 ins; 30 del; 93 mod Patch: https://git.openjdk.org/babylon/pull/520.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/520/head:pull/520 PR: https://git.openjdk.org/babylon/pull/520 From gfrost at openjdk.org Tue Aug 12 10:31:36 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 12 Aug 2025 10:31:36 GMT Subject: [code-reflection] Integrated: HAT remove trailing eol ws from pom.xml files In-Reply-To: References: Message-ID: On Tue, 12 Aug 2025 10:25:47 GMT, Gary Frost wrote: > Extended sanity check to include pom.xml files which detected trailing eol ws in pom files This pull request has now been integrated. Changeset: 33437b1f Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/33437b1f36c7fbaf7d58dc2f0691dde2b4deec04 Stats: 274 lines in 15 files changed: 151 ins; 30 del; 93 mod HAT remove trailing eol ws from pom.xml files ------------- PR: https://git.openjdk.org/babylon/pull/520 From gfrost at openjdk.org Tue Aug 12 10:31:45 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 12 Aug 2025 10:31:45 GMT Subject: git: openjdk/babylon: code-reflection: HAT remove trailing eol ws from pom.xml files Message-ID: <5f060f91-b3b7-4d38-839f-71e9c23135d9@openjdk.org> Changeset: 33437b1f Branch: code-reflection Author: Gary Frost Date: 2025-08-12 10:28:57 +0000 URL: https://git.openjdk.org/babylon/commit/33437b1f36c7fbaf7d58dc2f0691dde2b4deec04 HAT remove trailing eol ws from pom.xml files ! 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/shared/src/main/java/hat/backend/ffi/C99FFIBackend.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/KernelCallGraph.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/optools/ModuleOpWrapper.java ! hat/hat/Script.java ! hat/hat/run.java ! hat/wraps/cuda/pom.xml ! hat/wraps/opencl/pom.xml ! hat/wraps/opengl/pom.xml ! hat/wraps/pom.xml ! hat/wraps/shared/pom.xml From gfrost at openjdk.org Tue Aug 12 10:49:45 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 12 Aug 2025 10:49:45 GMT Subject: git: openjdk/babylon: code-reflection: [fix][hat] Codegen fixed when passing the kernel context to multiple invoke functions Message-ID: Changeset: b9b8906c Branch: code-reflection Author: Juan Fumero Committer: Gary Frost Date: 2025-08-12 10:47:25 +0000 URL: https://git.openjdk.org/babylon/commit/b9b8906cdd8f4d53ac8e34331a983d31070c6300 [fix][hat] Codegen fixed when passing the kernel context to multiple invoke functions ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/examples/matmul/src/main/java/matmul/Main.java From duke at openjdk.org Tue Aug 12 10:50:26 2025 From: duke at openjdk.org (Juan Fumero) Date: Tue, 12 Aug 2025 10:50:26 GMT Subject: [code-reflection] Integrated: [fix][hat] Codegen fixed when passing the kernel context to multiple invoke functions In-Reply-To: References: Message-ID: On Tue, 12 Aug 2025 09:56:00 GMT, Juan Fumero wrote: > This PR fixes the code generator when passing the `kernelContext` object to new invoke functions within the main compute kernel. > > Code like this: > ```java > @CodeReflection > public static float compute(@RO KernelContext kc, @RO F32Array matrixA, @RO F32Array matrixB, int size, int j) { > float acc = 0; > for (int k = 0; k < size; k++) { > acc += (matrixA.array(kc.x * size + k) * matrixB.array(k * size + j)); > } > return acc; > } > > @CodeReflection > public static void matrixMultiplyKernel1D(@RO KernelContext kc, @RO F32Array matrixA, @RO F32Array matrixB, @RW F32Array matrixC, int size) { > if (kc.x < kc.maxX) { > for (int j = 0; j < size; j++) { > float acc = compute(kc, matrixA, matrixB, size, j); > matrixC.array(kc.x * size + j, acc); > } > } > } > > > Generated the following error when compiling the kernel: > > > UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed > buildStatus =failed > logLen = 1993 log = program_source:33:5: error: unknown type name 'hat' > hat.KernelContext kc, __global F32Array_t* matrixA, __global F32Array_t* matrixB, int size, int j > ^ > > > This is due to the wrong naming from the `kernelContext` when it gets compiled to OpenCL or CUDA. > This PR patches this by checking the argument type and replacing with the appropriate CUDA/OpenCL struct. > > ### How to check? > > > HAT=INFO,SHOW_CODE java @hat/run ffi-opencl matmul 1DFC > > > This patch has been tested for both the OpenCL and the CUDA HAT Backends. This pull request has now been integrated. Changeset: b9b8906c Author: Juan Fumero Committer: Gary Frost URL: https://git.openjdk.org/babylon/commit/b9b8906cdd8f4d53ac8e34331a983d31070c6300 Stats: 50 lines in 2 files changed: 46 ins; 0 del; 4 mod [fix][hat] Codegen fixed when passing the kernel context to multiple invoke functions ------------- PR: https://git.openjdk.org/babylon/pull/519 From duke at openjdk.org Tue Aug 12 15:00:13 2025 From: duke at openjdk.org (Juan Fumero) Date: Tue, 12 Aug 2025 15:00:13 GMT Subject: [code-reflection] RFR: [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges [v3] In-Reply-To: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> References: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> Message-ID: > This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. > A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. > > Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. > > How to dispatch 1D kernels? > > > ComputeRange range1D = new ComputeRange(new GlobalMesh1D(size)); > cc.dispatchKernel(range1D, > kc -> myKernel(...)); > > > How to dispatch 2D kernels? > > > ComputeRange range2D = new ComputeRange(new GlobalMesh2D(size, size)); > cc.dispatchKernel(range2D, > kc -> my2DKernel(...)); > > > How to enable local mesh? > > We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. > > > ComputeRange computeRange = new ComputeRange( > new GlobalMesh2D(globalSize, globalSize), > new LocalMesh2D(16, 16)); > cc.dispatchKernel(computeRange, > kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) > ); > > > In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. > > > #### How to check? > > > java @hat/run ffi-opencl matmul 1D > java @hat/run ffi-opencl matmul 2D > > java @hat/run ffi-cuda matmul 1D > java @hat/run ffi-cuda matmul 2D Juan Fumero has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 10 commits: - Merge branch 'code-reflection' into hat/api/computerange - [hat] BuildCallGraph refactored - [hat] Improve logging for thread-mesh in OpenCL - [hat][cuda] 1D to 3D mesh refactored for the CUDA Backend - [hat] ThreadMesh Buffer composed with iFace to set global and local thread-mesh - [hat][api] ThreadMesh moved to records implementation - [hat] Javadoc for the rest of the ComputeRange Class - [hat] Add threadmesh subtyping to keep consistency accross dimensions between global and local - [hat] ThreadBlock dispatcher enabled for the CUDA backend - [hat][api] Proposal for ComputeRange and ThreadMesh ------------- Changes: https://git.openjdk.org/babylon/pull/516/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=516&range=02 Stats: 851 lines in 23 files changed: 709 ins; 91 del; 51 mod Patch: https://git.openjdk.org/babylon/pull/516.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/516/head:pull/516 PR: https://git.openjdk.org/babylon/pull/516 From psandoz at openjdk.org Tue Aug 12 15:29:03 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Tue, 12 Aug 2025 15:29:03 GMT Subject: git: openjdk/babylon: code-reflection: New example suite for code reflection Message-ID: <5ee7d4db-28fc-4f49-89e6-2fb381131372@openjdk.org> Changeset: 72e696eb Branch: code-reflection Author: Juan Fumero Committer: Paul Sandoz Date: 2025-08-12 15:26:14 +0000 URL: https://git.openjdk.org/babylon/commit/72e696ebc33c15044df961c088188f745aeb76b4 New example suite for code reflection Reviewed-by: psandoz + cr-examples/samples/README.md + cr-examples/samples/pom.xml + cr-examples/samples/src/main/java/oracle/code/samples/HelloCodeReflection.java + cr-examples/samples/src/main/java/oracle/code/samples/MathOptimizer.java From duke at openjdk.org Tue Aug 12 15:30:45 2025 From: duke at openjdk.org (Juan Fumero) Date: Tue, 12 Aug 2025 15:30:45 GMT Subject: [code-reflection] Integrated: New example suite for code reflection In-Reply-To: References: Message-ID: On Wed, 6 Aug 2025 10:39:43 GMT, Juan Fumero wrote: > New example suite for code reflection. It includes two programs that illustrate different functionality of the code reflection API. > > ### How to build? > > This module is built using the code-reflection fork of OpenJDK. Then, update the `JAVA_HOME` to point to the code-reflection port, and compile with maven. In detail: > > #### 1. Build Babylon JDK > > We need to use the JDK build that enables the code reflection API (Babylon). > > > git clone https://github.com/openjdk/babylon > cd babylon > bash configure --with-boot-jdk=${JAVA_HOME} > > > Then, we use the built JDK as `JAVA_HOME` > > > export JAVA_HOME=/$HOME/repos/babylon/build/macosx-aarch64-server-release/jdk/ > export PATH=$JAVA_HOME/bin:$PATH > > > #### 2. Build the example suite > > > mvn clean package > > > #### 3. Run the examples > > ##### Run HelloCodeReflection > > > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.HelloCodeReflection > > > ##### Run MathOptimizer > > > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizer > > > More example to appear in this module. This pull request has now been integrated. Changeset: 72e696eb Author: Juan Fumero Committer: Paul Sandoz URL: https://git.openjdk.org/babylon/commit/72e696ebc33c15044df961c088188f745aeb76b4 Stats: 529 lines in 4 files changed: 529 ins; 0 del; 0 mod New example suite for code reflection Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/513 From duke at openjdk.org Tue Aug 12 17:06:11 2025 From: duke at openjdk.org (Ruby Chen) Date: Tue, 12 Aug 2025 17:06:11 GMT Subject: [code-reflection] RFR: Minor logging changes for HAT ModuleOp support Message-ID: Add more descriptive logs for ModuleOp backend in HAT. To use the ModuleOp backend, pass `moduleOp` as an arg to the `hat/run.java` script when running a HAT example. For example, running the `mandel` example with the `ffi-opencl` backend and `moduleOp` enabled can be done with java @hat/run moduleOp ffi-opencl squares Adding `moduleOp` sets `-DmoduleOp=true` and passes it to the backend, which uses the flag to choose between the original `CallGraph` implementation and the new `moduleOp` implementation. `ModuleOpWrapper` now contains `createTransitiveInvokeModule()`, which creates a `ModuleOp` representing a call graph when given an entrypoint. This method is called in `KernelCallGraph` and `ComputeCallGraph` to generate their respective call graphs. The kernel and compute call graph classes also maintain a map of buffer accesses, along with structures storing other useful methods. The `C99FFIBackend`, `CudaBackend`, `MockBackend`, and `C99HATKernelBuilder` access call graphs structures differently depending on the `moduleOp` flag. ------------- Commit messages: - Fix naming for ModuleOp stdout logs - Add error messages and output mode to stdout Changes: https://git.openjdk.org/babylon/pull/521/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=521&range=00 Stats: 13 lines in 5 files changed: 10 ins; 0 del; 3 mod Patch: https://git.openjdk.org/babylon/pull/521.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/521/head:pull/521 PR: https://git.openjdk.org/babylon/pull/521 From duke at openjdk.org Tue Aug 12 17:06:11 2025 From: duke at openjdk.org (duke) Date: Tue, 12 Aug 2025 17:06:11 GMT Subject: [code-reflection] RFR: Minor logging changes for HAT ModuleOp support In-Reply-To: References: Message-ID: On Tue, 12 Aug 2025 16:57:25 GMT, Ruby Chen wrote: > Add more descriptive logs for ModuleOp backend in HAT. > > To use the ModuleOp backend, pass `moduleOp` as an arg to the `hat/run.java` script when running a HAT example. For example, running the `mandel` example with the `ffi-opencl` backend and `moduleOp` enabled can be done with > > java @hat/run moduleOp ffi-opencl squares > > Adding `moduleOp` sets `-DmoduleOp=true` and passes it to the backend, which uses the flag to choose between the original `CallGraph` implementation and the new `moduleOp` implementation. > > `ModuleOpWrapper` now contains `createTransitiveInvokeModule()`, which creates a `ModuleOp` representing a call graph when given an entrypoint. This method is called in `KernelCallGraph` and `ComputeCallGraph` to generate their respective call graphs. The kernel and compute call graph classes also maintain a map of buffer accesses, along with structures storing other useful methods. > > The `C99FFIBackend`, `CudaBackend`, `MockBackend`, and `C99HATKernelBuilder` access call graphs structures differently depending on the `moduleOp` flag. @rbrchen Your change (at version 07b1939532d4077c17d5a87fa3ea01e1bf3cb6fb) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/521#issuecomment-3180233871 From gfrost at openjdk.org Wed Aug 13 07:55:34 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 13 Aug 2025 07:55:34 GMT Subject: git: openjdk/babylon: code-reflection: Minor logging changes for HAT ModuleOp support Message-ID: <3270b08f-01f9-4ed9-993f-f3ef9b46bb34@openjdk.org> Changeset: ae9adb6f Branch: code-reflection Author: Ruby Chen Committer: Gary Frost Date: 2025-08-13 07:54:23 +0000 URL: https://git.openjdk.org/babylon/commit/ae9adb6f1c2be8d54a2d7a4dc3ee6d5e3352dac1 Minor logging changes for HAT ModuleOp support ! 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/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/core/src/main/java/hat/optools/ModuleOpWrapper.java ! hat/hat/run.java From duke at openjdk.org Wed Aug 13 07:57:27 2025 From: duke at openjdk.org (Ruby Chen) Date: Wed, 13 Aug 2025 07:57:27 GMT Subject: [code-reflection] Integrated: Minor logging changes for HAT ModuleOp support In-Reply-To: References: Message-ID: On Tue, 12 Aug 2025 16:57:25 GMT, Ruby Chen wrote: > Add more descriptive logs for ModuleOp backend in HAT. > > To use the ModuleOp backend, pass `moduleOp` as an arg to the `hat/run.java` script when running a HAT example. For example, running the `mandel` example with the `ffi-opencl` backend and `moduleOp` enabled can be done with > > java @hat/run moduleOp ffi-opencl squares > > Adding `moduleOp` sets `-DmoduleOp=true` and passes it to the backend, which uses the flag to choose between the original `CallGraph` implementation and the new `moduleOp` implementation. > > `ModuleOpWrapper` now contains `createTransitiveInvokeModule()`, which creates a `ModuleOp` representing a call graph when given an entrypoint. This method is called in `KernelCallGraph` and `ComputeCallGraph` to generate their respective call graphs. The kernel and compute call graph classes also maintain a map of buffer accesses, along with structures storing other useful methods. > > The `C99FFIBackend`, `CudaBackend`, `MockBackend`, and `C99HATKernelBuilder` access call graphs structures differently depending on the `moduleOp` flag. This pull request has now been integrated. Changeset: ae9adb6f Author: Ruby Chen Committer: Gary Frost URL: https://git.openjdk.org/babylon/commit/ae9adb6f1c2be8d54a2d7a4dc3ee6d5e3352dac1 Stats: 13 lines in 5 files changed: 10 ins; 0 del; 3 mod Minor logging changes for HAT ModuleOp support ------------- PR: https://git.openjdk.org/babylon/pull/521 From gfrost at openjdk.org Wed Aug 13 15:31:05 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 13 Aug 2025 15:31:05 GMT Subject: git: openjdk/babylon: code-reflection: Added an experiment to investigate Quoted Constant Args Message-ID: <3db92ce4-2235-4ca8-9ff8-8cf18c6bf412@openjdk.org> Changeset: 6c598848 Branch: code-reflection Author: Gary Frost Date: 2025-08-13 15:28:43 +0000 URL: https://git.openjdk.org/babylon/commit/6c598848fb15490c0a01368fed6f66845d93c888 Added an experiment to investigate Quoted Constant Args + hat/examples/experiments/src/main/java/experiments/QuotedConstantArgs.java From gfrost at openjdk.org Wed Aug 13 15:32:21 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 13 Aug 2025 15:32:21 GMT Subject: [code-reflection] Integrated: Added an experiment to investigate Quoted Constant Args Message-ID: An experiment to investigate issue observed passing constants as Quoted args After building you should be able to run (using opencl backend) with java --enable-preview --enable-native-access=ALL-UNNAMED --add-exports=jdk.incubator.code/jdk.incubator.code.dialect.java.impl=ALL-UNNAMED --class-path /Users/grfrost/github/babylon-grfrost-fork/hat/build/hat-core-1.0.jar:/Users/grfrost/github/babylon-grfrost-fork/hat/build/hat-backend-ffi-shared-1.0.jar:/Users/grfrost/github/babylon-grfrost-fork/hat/build/hat-backend-ffi-opencl-1.0.jar:/Users/grfrost/github/babylon-grfrost-fork/hat/build/hat-example-experiments-1.0.jar -Djava.library.path=/Users/grfrost/github/babylon-grfrost-fork/hat/build -DmoduleOp=true experiments.QuotedConstantArgs ------------- Commit messages: - Added an experiment to investigate Quoted Constant Args Changes: https://git.openjdk.org/babylon/pull/522/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=522&range=00 Stats: 63 lines in 1 file changed: 63 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/522.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/522/head:pull/522 PR: https://git.openjdk.org/babylon/pull/522 From gfrost at openjdk.org Wed Aug 13 15:32:22 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 13 Aug 2025 15:32:22 GMT Subject: [code-reflection] Integrated: Added an experiment to investigate Quoted Constant Args In-Reply-To: References: Message-ID: On Wed, 13 Aug 2025 15:25:40 GMT, Gary Frost wrote: > An experiment to investigate issue observed passing constants as Quoted args > > After building you should be able to run (using opencl backend) with > > > java --enable-preview --enable-native-access=ALL-UNNAMED --add-exports=jdk.incubator.code/jdk.incubator.code.dialect.java.impl=ALL-UNNAMED --class-path /Users/grfrost/github/babylon-grfrost-fork/hat/build/hat-core-1.0.jar:/Users/grfrost/github/babylon-grfrost-fork/hat/build/hat-backend-ffi-shared-1.0.jar:/Users/grfrost/github/babylon-grfrost-fork/hat/build/hat-backend-ffi-opencl-1.0.jar:/Users/grfrost/github/babylon-grfrost-fork/hat/build/hat-example-experiments-1.0.jar -Djava.library.path=/Users/grfrost/github/babylon-grfrost-fork/hat/build -DmoduleOp=true experiments.QuotedConstantArgs This pull request has now been integrated. Changeset: 6c598848 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/6c598848fb15490c0a01368fed6f66845d93c888 Stats: 63 lines in 1 file changed: 63 ins; 0 del; 0 mod Added an experiment to investigate Quoted Constant Args ------------- PR: https://git.openjdk.org/babylon/pull/522 From gfrost at openjdk.org Wed Aug 13 17:01:33 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 13 Aug 2025 17:01:33 GMT Subject: git: openjdk/babylon: code-reflection: Added more quoted experiments Message-ID: <2ef2ed8f-2ba5-4b4f-9e3d-ca70e8d7a165@openjdk.org> Changeset: 700e5ee3 Branch: code-reflection Author: Gary Frost Date: 2025-08-13 16:58:48 +0000 URL: https://git.openjdk.org/babylon/commit/700e5ee3957a251e926ae29675944fbfe671fda0 Added more quoted experiments + hat/examples/experiments/src/main/java/experiments/QuotedArrayArg.java ! hat/examples/experiments/src/main/java/experiments/QuotedConstantArgs.java From gfrost at openjdk.org Wed Aug 13 17:02:47 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 13 Aug 2025 17:02:47 GMT Subject: [code-reflection] Integrated: Added more quoted experiments Message-ID: Added a couple more quoted experiments This time added QuotedArrayArg ------------- Commit messages: - Added more quoted experiments Changes: https://git.openjdk.org/babylon/pull/523/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=523&range=00 Stats: 76 lines in 2 files changed: 74 ins; 0 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/523.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/523/head:pull/523 PR: https://git.openjdk.org/babylon/pull/523 From gfrost at openjdk.org Wed Aug 13 17:02:47 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 13 Aug 2025 17:02:47 GMT Subject: [code-reflection] Integrated: Added more quoted experiments In-Reply-To: References: Message-ID: On Wed, 13 Aug 2025 16:54:58 GMT, Gary Frost wrote: > Added a couple more quoted experiments > > This time added QuotedArrayArg This pull request has now been integrated. Changeset: 700e5ee3 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/700e5ee3957a251e926ae29675944fbfe671fda0 Stats: 76 lines in 2 files changed: 74 ins; 0 del; 2 mod Added more quoted experiments ------------- PR: https://git.openjdk.org/babylon/pull/523 From psandoz at openjdk.org Wed Aug 13 22:37:35 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 13 Aug 2025 22:37:35 GMT Subject: [code-reflection] RFR: Fix interpreter arg checking Message-ID: A prior update to the interpreter to check its arguments caused some test failures. This is a quick fix to ensure test pass while still ensuring most checks are still in place 1. ensure run time representation of variables (Var) are supported. 2. allow for primitive conversions, which for now i punt on and just let them through, as the check needs more thought. 3. accept null for any argument, refine later for primitive values. ------------- Commit messages: - Fix interpreter arg checking. Changes: https://git.openjdk.org/babylon/pull/524/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=524&range=00 Stats: 9 lines in 2 files changed: 4 ins; 3 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/524.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/524/head:pull/524 PR: https://git.openjdk.org/babylon/pull/524 From psandoz at openjdk.org Wed Aug 13 22:48:30 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 13 Aug 2025 22:48:30 GMT Subject: [code-reflection] Integrated: Fix interpreter arg checking In-Reply-To: References: Message-ID: On Wed, 13 Aug 2025 22:30:44 GMT, Paul Sandoz wrote: > A prior update to the interpreter to check its arguments caused some test failures. This is a quick fix to ensure test pass while still ensuring most checks are still in place > 1. ensure run time representation of variables (Var) are supported. > 2. allow for primitive conversions, which for now i punt on and just let them through, as the check needs more thought. > 3. accept null for any argument, refine later for primitive values. This pull request has now been integrated. Changeset: c5102d7e Author: Paul Sandoz URL: https://git.openjdk.org/babylon/commit/c5102d7e1e7e688cb6aa34f5e474d8c0d989c141 Stats: 9 lines in 2 files changed: 4 ins; 3 del; 2 mod Fix interpreter arg checking ------------- PR: https://git.openjdk.org/babylon/pull/524 From psandoz at openjdk.org Wed Aug 13 22:48:54 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 13 Aug 2025 22:48:54 GMT Subject: git: openjdk/babylon: code-reflection: Fix interpreter arg checking Message-ID: <632dc8af-15c3-45cc-a8bd-f8e62944de6c@openjdk.org> Changeset: c5102d7e Branch: code-reflection Author: Paul Sandoz Date: 2025-08-13 22:45:12 +0000 URL: https://git.openjdk.org/babylon/commit/c5102d7e1e7e688cb6aa34f5e474d8c0d989c141 Fix interpreter arg checking ! src/jdk.incubator.code/share/classes/jdk/incubator/code/interpreter/Interpreter.java ! test/jdk/java/lang/reflect/code/interpreter/TestArgsTypesValidationWhenInterpreting.java From duke at openjdk.org Thu Aug 14 07:18:17 2025 From: duke at openjdk.org (Juan Fumero) Date: Thu, 14 Aug 2025 07:18:17 GMT Subject: [code-reflection] RFR: Expand the example suite with Inlining and Bytecode generation Message-ID: This PR extends the sample suite for learning code reflection. It adds a couple of examples to learn how to apply inlining. 1. Inline values 2. Inline new code-reflected methods after code transformations. In addition, it expands the examples to generate Java bytecode from code models. All examples have been documented. #### How to compile and run export JAVA_HOME= mvn clean package java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.InlineExample java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizerWithInlining ------------- Commit messages: - [samples] documentation added - [samples] Documentation added - Javadoc for new examples - Add missing examples - [samples] Two new examples to show how to inline Changes: https://git.openjdk.org/babylon/pull/525/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=525&range=00 Stats: 486 lines in 5 files changed: 475 ins; 0 del; 11 mod Patch: https://git.openjdk.org/babylon/pull/525.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/525/head:pull/525 PR: https://git.openjdk.org/babylon/pull/525 From duke at openjdk.org Thu Aug 14 08:36:24 2025 From: duke at openjdk.org (duke) Date: Thu, 14 Aug 2025 08:36:24 GMT Subject: [code-reflection] RFR: Expand the example suite with Inlining and Bytecode generation In-Reply-To: References: Message-ID: On Thu, 14 Aug 2025 07:11:14 GMT, Juan Fumero wrote: > This PR extends the sample suite for learning code reflection. It adds a couple of examples to learn how to apply inlining. > 1. Inline values > 2. Inline new code-reflected methods after code transformations. > > In addition, it expands the examples to generate Java bytecode from code models. > > All examples have been documented. > > #### How to compile and run > > > export JAVA_HOME= > mvn clean package > > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.InlineExample > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizerWithInlining @jjfumero Your change (at version fcfca2a269e73b87a7e8492bd103d490dbbfbc1f) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/525#issuecomment-3187486440 From duke at openjdk.org Thu Aug 14 08:38:41 2025 From: duke at openjdk.org (Juan Fumero) Date: Thu, 14 Aug 2025 08:38:41 GMT Subject: [code-reflection] RFR: [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges [v4] In-Reply-To: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> References: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> Message-ID: > This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. > A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. > > Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. > > How to dispatch 1D kernels? > > > ComputeRange range1D = new ComputeRange(new GlobalMesh1D(size)); > cc.dispatchKernel(range1D, > kc -> myKernel(...)); > > > How to dispatch 2D kernels? > > > ComputeRange range2D = new ComputeRange(new GlobalMesh2D(size, size)); > cc.dispatchKernel(range2D, > kc -> my2DKernel(...)); > > > How to enable local mesh? > > We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. > > > ComputeRange computeRange = new ComputeRange( > new GlobalMesh2D(globalSize, globalSize), > new LocalMesh2D(16, 16)); > cc.dispatchKernel(computeRange, > kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) > ); > > > In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. > > > #### How to check? > > > java @hat/run ffi-opencl matmul 1D > java @hat/run ffi-opencl matmul 2D > > java @hat/run ffi-cuda matmul 1D > java @hat/run ffi-cuda matmul 2D Juan Fumero has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 11 commits: - Merge branch 'code-reflection' into hat/api/computerange - Merge branch 'code-reflection' into hat/api/computerange - [hat] BuildCallGraph refactored - [hat] Improve logging for thread-mesh in OpenCL - [hat][cuda] 1D to 3D mesh refactored for the CUDA Backend - [hat] ThreadMesh Buffer composed with iFace to set global and local thread-mesh - [hat][api] ThreadMesh moved to records implementation - [hat] Javadoc for the rest of the ComputeRange Class - [hat] Add threadmesh subtyping to keep consistency accross dimensions between global and local - [hat] ThreadBlock dispatcher enabled for the CUDA backend - ... and 1 more: https://git.openjdk.org/babylon/compare/c5102d7e...31bee39b ------------- Changes: https://git.openjdk.org/babylon/pull/516/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=516&range=03 Stats: 851 lines in 23 files changed: 709 ins; 91 del; 51 mod Patch: https://git.openjdk.org/babylon/pull/516.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/516/head:pull/516 PR: https://git.openjdk.org/babylon/pull/516 From duke at openjdk.org Thu Aug 14 08:49:30 2025 From: duke at openjdk.org (duke) Date: Thu, 14 Aug 2025 08:49:30 GMT Subject: [code-reflection] RFR: [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges [v4] In-Reply-To: References: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> Message-ID: On Thu, 14 Aug 2025 08:38:41 GMT, Juan Fumero wrote: >> This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. >> A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. >> >> Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. >> >> How to dispatch 1D kernels? >> >> >> ComputeRange range1D = new ComputeRange(new GlobalMesh1D(size)); >> cc.dispatchKernel(range1D, >> kc -> myKernel(...)); >> >> >> How to dispatch 2D kernels? >> >> >> ComputeRange range2D = new ComputeRange(new GlobalMesh2D(size, size)); >> cc.dispatchKernel(range2D, >> kc -> my2DKernel(...)); >> >> >> How to enable local mesh? >> >> We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. >> >> >> ComputeRange computeRange = new ComputeRange( >> new GlobalMesh2D(globalSize, globalSize), >> new LocalMesh2D(16, 16)); >> cc.dispatchKernel(computeRange, >> kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) >> ); >> >> >> In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. >> >> >> #### How to check? >> >> >> java @hat/run ffi-opencl matmul 1D >> java @hat/run ffi-opencl matmul 2D >> >> java @hat/run ffi-cuda matmul 1D >> java @hat/run ffi-cuda matmul 2D > > Juan Fumero has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 11 commits: > > - Merge branch 'code-reflection' into hat/api/computerange > - Merge branch 'code-reflection' into hat/api/computerange > - [hat] BuildCallGraph refactored > - [hat] Improve logging for thread-mesh in OpenCL > - [hat][cuda] 1D to 3D mesh refactored for the CUDA Backend > - [hat] ThreadMesh Buffer composed with iFace to set global and local thread-mesh > - [hat][api] ThreadMesh moved to records implementation > - [hat] Javadoc for the rest of the ComputeRange Class > - [hat] Add threadmesh subtyping to keep consistency accross dimensions between global and local > - [hat] ThreadBlock dispatcher enabled for the CUDA backend > - ... and 1 more: https://git.openjdk.org/babylon/compare/c5102d7e...31bee39b @jjfumero Your change (at version 31bee39b5c4a355cfec341d479ec007871af69ea) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/516#issuecomment-3187524303 From gfrost at openjdk.org Thu Aug 14 11:05:37 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 14 Aug 2025 11:05:37 GMT Subject: git: openjdk/babylon: code-reflection: Expand the example suite with Inlining and Bytecode generation Message-ID: Changeset: 19daae13 Branch: code-reflection Author: Juan Fumero Committer: Gary Frost Date: 2025-08-14 11:04:42 +0000 URL: https://git.openjdk.org/babylon/commit/19daae133c6fc99c31a02a276cc11fdf2a8a099a Expand the example suite with Inlining and Bytecode generation ! cr-examples/samples/README.md ! cr-examples/samples/src/main/java/oracle/code/samples/HelloCodeReflection.java + cr-examples/samples/src/main/java/oracle/code/samples/InlineExample.java ! cr-examples/samples/src/main/java/oracle/code/samples/MathOptimizer.java + cr-examples/samples/src/main/java/oracle/code/samples/MathOptimizerWithInlining.java From duke at openjdk.org Thu Aug 14 11:08:38 2025 From: duke at openjdk.org (Juan Fumero) Date: Thu, 14 Aug 2025 11:08:38 GMT Subject: [code-reflection] Integrated: Expand the example suite with Inlining and Bytecode generation In-Reply-To: References: Message-ID: On Thu, 14 Aug 2025 07:11:14 GMT, Juan Fumero wrote: > This PR extends the sample suite for learning code reflection. It adds a couple of examples to learn how to apply inlining. > 1. Inline values > 2. Inline new code-reflected methods after code transformations. > > In addition, it expands the examples to generate Java bytecode from code models. > > All examples have been documented. > > #### How to compile and run > > > export JAVA_HOME= > mvn clean package > > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.InlineExample > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizerWithInlining This pull request has now been integrated. Changeset: 19daae13 Author: Juan Fumero Committer: Gary Frost URL: https://git.openjdk.org/babylon/commit/19daae133c6fc99c31a02a276cc11fdf2a8a099a Stats: 486 lines in 5 files changed: 475 ins; 0 del; 11 mod Expand the example suite with Inlining and Bytecode generation ------------- PR: https://git.openjdk.org/babylon/pull/525 From gfrost at openjdk.org Thu Aug 14 11:09:56 2025 From: gfrost at openjdk.org (Gary Frost) Date: Thu, 14 Aug 2025 11:09:56 GMT Subject: git: openjdk/babylon: code-reflection: [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges Message-ID: <59ef7dac-dc68-476f-b87f-33abeefc72f2@openjdk.org> Changeset: 92df1be6 Branch: code-reflection Author: Juan Fumero Committer: Gary Frost Date: 2025-08-14 11:07:48 +0000 URL: https://git.openjdk.org/babylon/commit/92df1be61c8ef32f3ea2ac64c33b340b19737ec6 [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges ! hat/backends/ffi/cuda/src/main/native/cpp/cuda_backend_queue.cpp ! 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_queue.cpp ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/backends/ffi/shared/src/main/native/cpp/shared.cpp ! hat/backends/ffi/shared/src/main/native/include/shared.h ! 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/ComputeRange.java + hat/core/src/main/java/hat/GlobalMesh1D.java + hat/core/src/main/java/hat/GlobalMesh2D.java + hat/core/src/main/java/hat/GlobalMesh3D.java ! hat/core/src/main/java/hat/KernelContext.java + hat/core/src/main/java/hat/LocalMesh1D.java + hat/core/src/main/java/hat/LocalMesh2D.java + hat/core/src/main/java/hat/LocalMesh3D.java + hat/core/src/main/java/hat/ThreadMesh.java + hat/core/src/main/java/hat/buffer/KernelBufferContext.java - hat/core/src/main/java/hat/buffer/KernelContext.java ! hat/core/src/main/java/hat/optools/InvokeOpWrapper.java ! hat/examples/matmul/src/main/java/matmul/Main.java From duke at openjdk.org Thu Aug 14 11:11:32 2025 From: duke at openjdk.org (Juan Fumero) Date: Thu, 14 Aug 2025 11:11:32 GMT Subject: [code-reflection] Integrated: [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges In-Reply-To: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> References: <-lCItgPVgLRL31tktliCjAtnmxwxPiVxeFgd4_w1jXk=.4ed5ebab-e449-4334-b90f-3ee721874c1e@github.com> Message-ID: <_BXIbNZ7IPd0OIvP6eiyE8_2AnQwNh-9gSyxYWftaGs=.5327ffdb-034d-4dd9-a3f6-ba59914f0eaa@github.com> On Fri, 8 Aug 2025 14:00:23 GMT, Juan Fumero wrote: > This PR proposes an extension of the HAT API to leverage 1D, 2D and 3D ranges for the compute context dispatch. > A `ComputeRange` is an entity that holds global and local thread mesh. In the future, we can add offsets to it. > > Each `ThreadMesh` is a triplet representing the number of threads for x,y, and z dimensions. > > How to dispatch 1D kernels? > > > ComputeRange range1D = new ComputeRange(new GlobalMesh1D(size)); > cc.dispatchKernel(range1D, > kc -> myKernel(...)); > > > How to dispatch 2D kernels? > > > ComputeRange range2D = new ComputeRange(new GlobalMesh2D(size, size)); > cc.dispatchKernel(range2D, > kc -> my2DKernel(...)); > > > How to enable local mesh? > > We pass a second parameter to the ComputeRange constructor to define local mesh. If it is not passed, then it is `null` and the HAT runtime can select a default set of values. > > > ComputeRange computeRange = new ComputeRange( > new GlobalMesh2D(globalSize, globalSize), > new LocalMesh2D(16, 16)); > cc.dispatchKernel(computeRange, > kc -> matrixMultiplyKernel2D(kc, matrixA, matrixB, matrixC, globalSize) > ); > > > In addition, this PR renames the `KernelContext` internal API to map the context ndrange object to native memory to `KernelBufferContext`. > > > #### How to check? > > > java @hat/run ffi-opencl matmul 1D > java @hat/run ffi-opencl matmul 2D > > java @hat/run ffi-cuda matmul 1D > java @hat/run ffi-cuda matmul 2D This pull request has now been integrated. Changeset: 92df1be6 Author: Juan Fumero Committer: Gary Frost URL: https://git.openjdk.org/babylon/commit/92df1be61c8ef32f3ea2ac64c33b340b19737ec6 Stats: 851 lines in 23 files changed: 709 ins; 91 del; 51 mod [hat][proposal] ComputeRange and ThreadMesh API for defining 1D, 2D and 3D Ranges ------------- PR: https://git.openjdk.org/babylon/pull/516 From gfrost at openjdk.org Sun Aug 17 12:41:32 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 17 Aug 2025 12:41:32 GMT Subject: git: openjdk/babylon: code-reflection: Use existing code for creating KernelContext_s from its iface buffer schema Message-ID: Changeset: bb4f7ff8 Branch: code-reflection Author: Gary Frost Date: 2025-08-17 12:38:47 +0000 URL: https://git.openjdk.org/babylon/commit/bb4f7ff8f94590f4e019a9c28c354e461ad91821 Use existing code for creating KernelContext_s from its iface buffer schema ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilderWithContext.java From gfrost at openjdk.org Sun Aug 17 12:42:12 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 17 Aug 2025 12:42:12 GMT Subject: [code-reflection] Integrated: Use existing code for creating KernelContext_s from its iface buffer schema Message-ID: Previously we had custom code for creating KernelContext_s C99 code. We already had code which could create typedefed structs from iface schemas. Now KernelContext is an iface mapped buffer we can use this same code. This stops us from having tto manually ensure that the class and generated C99 code were in sync. ------------- Commit messages: - Use existing code for creating KernelContext_s from its iface buffer schema Changes: https://git.openjdk.org/babylon/pull/526/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=526&range=00 Stats: 50 lines in 2 files changed: 10 ins; 21 del; 19 mod Patch: https://git.openjdk.org/babylon/pull/526.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/526/head:pull/526 PR: https://git.openjdk.org/babylon/pull/526 From gfrost at openjdk.org Sun Aug 17 12:42:12 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sun, 17 Aug 2025 12:42:12 GMT Subject: [code-reflection] Integrated: Use existing code for creating KernelContext_s from its iface buffer schema In-Reply-To: References: Message-ID: On Sun, 17 Aug 2025 12:35:29 GMT, Gary Frost wrote: > Previously we had custom code for creating KernelContext_s C99 code. > > We already had code which could create typedefed structs from iface schemas. > > Now KernelContext is an iface mapped buffer we can use this same code. This stops us from having tto manually ensure that the class and generated C99 code were in sync. This pull request has now been integrated. Changeset: bb4f7ff8 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/bb4f7ff8f94590f4e019a9c28c354e461ad91821 Stats: 50 lines in 2 files changed: 10 ins; 21 del; 19 mod Use existing code for creating KernelContext_s from its iface buffer schema ------------- PR: https://git.openjdk.org/babylon/pull/526 From mabbay at openjdk.org Sun Aug 17 17:07:12 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Sun, 17 Aug 2025 17:07:12 GMT Subject: [code-reflection] RFR: Document quoteOp and quotedOp methods [v7] In-Reply-To: References: Message-ID: > Specify the behaviour of quoteOp and quotedOp methods. Mourad Abbay has updated the pull request incrementally with three additional commits since the last revision: - Update Quoted.quoteOp documentation - Correct validation in Quoted constructor - Don't include duplicate operands / captured values when quoting an operation ------------- Changes: - all: https://git.openjdk.org/babylon/pull/512/files - new: https://git.openjdk.org/babylon/pull/512/files/1fcefbcf..34cc6a8f Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=06 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=05-06 Stats: 176 lines in 2 files changed: 132 ins; 20 del; 24 mod Patch: https://git.openjdk.org/babylon/pull/512.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/512/head:pull/512 PR: https://git.openjdk.org/babylon/pull/512 From duke at openjdk.org Tue Aug 19 10:00:45 2025 From: duke at openjdk.org (Juan Fumero) Date: Tue, 19 Aug 2025 10:00:45 GMT Subject: [code-reflection] RFR: [hat][proposal] Adding notion of local thread ids and local group sizes int HAT Message-ID: This PR extends the `KernelContext` API to access local thread ids and group sizes. It keeps compatibility with the prev. API, thus, it maintains the `kernelcontext.x` and `kernelcontext.maxX` thread accessors. However, we might remove this in near future in favour for the kernelContext.gix and `kernelcontext.gsx`. This is just a proposal. Simple example: @CodeReflection private static void assign(@RO KernelContext context, @RW S32Array arrayA, @RW S32Array arrayB, @RW S32Array arrayC) { int gix = context.gix; int lix = context.lix; int lsx = context.lsx; int bsx = context.bsx; arrayA.array (gix, lix); // Store local thread id arrayB.array(gix, lsx); // Store local size arrayC.array(gix, bsx); // Store thread block id } How to test: # For OpenCL java -cp job.jar hat.java exp ffi-opencl $@ # For CUDA java -cp job.jar hat.java exp ffi-cuda $@ Still a draft PR until double checking with the CUDA backend. ------------- Commit messages: - [hat] Remove old kernel context code - [hat] CUDA thread-block and block dispatch fixed - [hat] roll back to plain kernelContext in the C99 kernel (ocl) - [hat] Definition of local ids and local groups - [hat] comment for future codegen of the kernelContext - ComputeContext names simplified - Merge branch 'code-reflection' into hat/api/local - [hat] fix field ordering to process local/global groups and local thread ids - [hat] Sample local ids documented - [hat] jextracted codegen fixed - ... and 12 more: https://git.openjdk.org/babylon/compare/bb4f7ff8...0044f814 Changes: https://git.openjdk.org/babylon/pull/527/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=527&range=00 Stats: 634 lines in 20 files changed: 469 ins; 95 del; 70 mod Patch: https://git.openjdk.org/babylon/pull/527.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/527/head:pull/527 PR: https://git.openjdk.org/babylon/pull/527 From duke at openjdk.org Tue Aug 19 10:00:45 2025 From: duke at openjdk.org (Juan Fumero) Date: Tue, 19 Aug 2025 10:00:45 GMT Subject: [code-reflection] RFR: [hat][proposal] Adding notion of local thread ids and local group sizes int HAT In-Reply-To: References: Message-ID: On Mon, 18 Aug 2025 14:10:45 GMT, Juan Fumero wrote: > This PR extends the `KernelContext` API to access local thread ids and group sizes. > > It keeps compatibility with the prev. API, thus, it maintains the `kernelcontext.x` and `kernelcontext.maxX` thread accessors. However, we might remove this in near future in favour for the kernelContext.gix and `kernelcontext.gsx`. > This is just a proposal. > > Simple example: > > > @CodeReflection > private static void assign(@RO KernelContext context, @RW S32Array arrayA, @RW S32Array arrayB, @RW S32Array arrayC) { > int gix = context.gix; > int lix = context.lix; > int lsx = context.lsx; > int bsx = context.bsx; > arrayA.array (gix, lix); // Store local thread id > arrayB.array(gix, lsx); // Store local size > arrayC.array(gix, bsx); // Store thread block id > } > > > How to test: > > > > # For OpenCL > java -cp job.jar hat.java exp ffi-opencl $@ > > # For CUDA > java -cp job.jar hat.java exp ffi-cuda $@ > > > Still a draft PR until double checking with the CUDA backend. Ready for review ------------- PR Comment: https://git.openjdk.org/babylon/pull/527#issuecomment-3200049316 From duke at openjdk.org Tue Aug 19 10:00:46 2025 From: duke at openjdk.org (duke) Date: Tue, 19 Aug 2025 10:00:46 GMT Subject: [code-reflection] RFR: [hat][proposal] Adding notion of local thread ids and local group sizes int HAT In-Reply-To: References: Message-ID: On Mon, 18 Aug 2025 14:10:45 GMT, Juan Fumero wrote: > This PR extends the `KernelContext` API to access local thread ids and group sizes. > > It keeps compatibility with the prev. API, thus, it maintains the `kernelcontext.x` and `kernelcontext.maxX` thread accessors. However, we might remove this in near future in favour for the kernelContext.gix and `kernelcontext.gsx`. > This is just a proposal. > > Simple example: > > > @CodeReflection > private static void assign(@RO KernelContext context, @RW S32Array arrayA, @RW S32Array arrayB, @RW S32Array arrayC) { > int gix = context.gix; > int lix = context.lix; > int lsx = context.lsx; > int bsx = context.bsx; > arrayA.array (gix, lix); // Store local thread id > arrayB.array(gix, lsx); // Store local size > arrayC.array(gix, bsx); // Store thread block id > } > > > How to test: > > > > # For OpenCL > java -cp job.jar hat.java exp ffi-opencl $@ > > # For CUDA > java -cp job.jar hat.java exp ffi-cuda $@ > > > Still a draft PR until double checking with the CUDA backend. @jjfumero Your change (at version 0044f81495311785e34cf2f3f0a5476a37f6ba1c) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/527#issuecomment-3200064936 From duke at openjdk.org Tue Aug 19 10:36:02 2025 From: duke at openjdk.org (Juan Fumero) Date: Tue, 19 Aug 2025 10:36:02 GMT Subject: [code-reflection] RFR: [hat][proposal] Adding notion of local thread ids and local group sizes int HAT In-Reply-To: References: Message-ID: On Mon, 18 Aug 2025 14:10:45 GMT, Juan Fumero wrote: > This PR extends the `KernelContext` API to access local thread ids and group sizes. > > It keeps compatibility with the prev. API, thus, it maintains the `kernelcontext.x` and `kernelcontext.maxX` thread accessors. However, we might remove this in near future in favour for the kernelContext.gix and `kernelcontext.gsx`. > This is just a proposal. > > Simple example: > > > @CodeReflection > private static void assign(@RO KernelContext context, @RW S32Array arrayA, @RW S32Array arrayB, @RW S32Array arrayC) { > int gix = context.gix; > int lix = context.lix; > int lsx = context.lsx; > int bsx = context.bsx; > arrayA.array (gix, lix); // Store local thread id > arrayB.array(gix, lsx); // Store local size > arrayC.array(gix, bsx); // Store thread block id > } > > > How to test: > > > > # For OpenCL > java -cp job.jar hat.java exp ffi-opencl $@ > > # For CUDA > java -cp job.jar hat.java exp ffi-cuda $@ > > > Still a draft PR until double checking with the CUDA backend. Moving to draft again. Let's complete this PR with the notion of block index as well. ------------- PR Comment: https://git.openjdk.org/babylon/pull/527#issuecomment-3200188949 From duke at openjdk.org Tue Aug 19 12:17:16 2025 From: duke at openjdk.org (Juan Fumero) Date: Tue, 19 Aug 2025 12:17:16 GMT Subject: [code-reflection] RFR: [hat][proposal] Adding notion of local thread ids and local group sizes int HAT [v2] In-Reply-To: References: Message-ID: > This PR extends the `KernelContext` API to access local thread ids and group sizes. > > It keeps compatibility with the prev. API, thus, it maintains the `kernelcontext.x` and `kernelcontext.maxX` thread accessors. However, we might remove this in near future in favour for the kernelContext.gix and `kernelcontext.gsx`. > This is just a proposal. > > Simple example: > > > @CodeReflection > private static void assign(@RO KernelContext context, @RW S32Array arrayA, @RW S32Array arrayB, @RW S32Array arrayC) { > int gix = context.gix; > int lix = context.lix; > int lsx = context.lsx; > int bsx = context.bsx; > arrayA.array (gix, lix); // Store local thread id > arrayB.array(gix, lsx); // Store local size > arrayC.array(gix, bsx); // Store thread block id > } > > > How to test: > > > > # For OpenCL > java -cp job.jar hat.java exp ffi-opencl $@ > > # For CUDA > java -cp job.jar hat.java exp ffi-cuda $@ > > > Still a draft PR until double checking with the CUDA backend. Juan Fumero has updated the pull request incrementally with two additional commits since the last revision: - [hat] Fix hat jextracted build - [hat] Fix block id and global size indexing for OpenCL ------------- Changes: - all: https://git.openjdk.org/babylon/pull/527/files - new: https://git.openjdk.org/babylon/pull/527/files/0044f814..1206a15a Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=527&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=527&range=00-01 Stats: 87 lines in 8 files changed: 41 ins; 14 del; 32 mod Patch: https://git.openjdk.org/babylon/pull/527.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/527/head:pull/527 PR: https://git.openjdk.org/babylon/pull/527 From duke at openjdk.org Tue Aug 19 12:17:16 2025 From: duke at openjdk.org (duke) Date: Tue, 19 Aug 2025 12:17:16 GMT Subject: [code-reflection] RFR: [hat][proposal] Adding notion of local thread ids and local group sizes int HAT In-Reply-To: References: Message-ID: <_wp4LAONzi5DEy_ld9mjQCB9hvwL97FwEdeSL-zwNM4=.25e86220-cce7-4f2e-8e69-c701fef66b97@github.com> On Mon, 18 Aug 2025 14:10:45 GMT, Juan Fumero wrote: > This PR extends the `KernelContext` API to access local thread ids and group sizes. > > It keeps compatibility with the prev. API, thus, it maintains the `kernelcontext.x` and `kernelcontext.maxX` thread accessors. However, we might remove this in near future in favour for the kernelContext.gix and `kernelcontext.gsx`. > This is just a proposal. > > Simple example: > > > @CodeReflection > private static void assign(@RO KernelContext context, @RW S32Array arrayA, @RW S32Array arrayB, @RW S32Array arrayC) { > int gix = context.gix; > int lix = context.lix; > int lsx = context.lsx; > int bsx = context.bsx; > arrayA.array (gix, lix); // Store local thread id > arrayB.array(gix, lsx); // Store local size > arrayC.array(gix, bsx); // Store thread block id > } > > > How to test: > > > > # For OpenCL > java -cp job.jar hat.java exp ffi-opencl $@ > > # For CUDA > java -cp job.jar hat.java exp ffi-cuda $@ > > > Still a draft PR until double checking with the CUDA backend. @jjfumero Your change (at version 1206a15a9b4a76f2fbf55de2dfd9fb096c65177c) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/527#issuecomment-3200508657 From gfrost at openjdk.org Tue Aug 19 12:18:12 2025 From: gfrost at openjdk.org (Gary Frost) Date: Tue, 19 Aug 2025 12:18:12 GMT Subject: git: openjdk/babylon: code-reflection: [hat][proposal] Adding notion of local thread ids and local group sizes int HAT Message-ID: <46627676-bf94-4ede-bb1c-f6f71974b950@openjdk.org> Changeset: cd6cf341 Branch: code-reflection Author: Juan Fumero Committer: Gary Frost Date: 2025-08-19 12:16:55 +0000 URL: https://git.openjdk.org/babylon/commit/cd6cf341929f9a83591a4a4dc780cad87a113af0 [hat][proposal] Adding notion of local thread ids and local group sizes int HAT ! hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java ! hat/backends/ffi/cuda/src/main/native/cpp/cuda_backend_queue.cpp ! hat/backends/ffi/mock/src/main/native/cpp/mock_backend.cpp ! hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLHATKernelBuilder.java ! hat/backends/ffi/opencl/src/main/native/cpp/opencl_backend_queue.cpp ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/C99FFIBackend.java ! hat/backends/ffi/shared/src/main/native/cpp/shared.cpp ! hat/backends/ffi/shared/src/main/native/include/shared.h ! 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/GlobalMesh1D.java ! hat/core/src/main/java/hat/GlobalMesh2D.java ! hat/core/src/main/java/hat/KernelContext.java ! hat/core/src/main/java/hat/LocalMesh1D.java ! hat/core/src/main/java/hat/LocalMesh2D.java - hat/core/src/main/java/hat/buffer/KernelBufferContext.java + hat/core/src/main/java/hat/buffer/KernelContext.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/optools/InvokeOpWrapper.java + hat/examples/experiments/src/main/java/experiments/LocalIds.java From duke at openjdk.org Tue Aug 19 12:20:58 2025 From: duke at openjdk.org (Juan Fumero) Date: Tue, 19 Aug 2025 12:20:58 GMT Subject: [code-reflection] Integrated: [hat][proposal] Adding notion of local thread ids and local group sizes int HAT In-Reply-To: References: Message-ID: On Mon, 18 Aug 2025 14:10:45 GMT, Juan Fumero wrote: > This PR extends the `KernelContext` API to access local thread ids and group sizes. > > It keeps compatibility with the prev. API, thus, it maintains the `kernelcontext.x` and `kernelcontext.maxX` thread accessors. However, we might remove this in near future in favour for the kernelContext.gix and `kernelcontext.gsx`. > This is just a proposal. > > Simple example: > > > @CodeReflection > private static void assign(@RO KernelContext context, @RW S32Array arrayA, @RW S32Array arrayB, @RW S32Array arrayC) { > int gix = context.gix; > int lix = context.lix; > int lsx = context.lsx; > int bsx = context.bsx; > arrayA.array (gix, lix); // Store local thread id > arrayB.array(gix, lsx); // Store local size > arrayC.array(gix, bsx); // Store thread block id > } > > > How to test: > > > > # For OpenCL > java -cp job.jar hat.java exp ffi-opencl $@ > > # For CUDA > java -cp job.jar hat.java exp ffi-cuda $@ > > > Still a draft PR until double checking with the CUDA backend. This pull request has now been integrated. Changeset: cd6cf341 Author: Juan Fumero Committer: Gary Frost URL: https://git.openjdk.org/babylon/commit/cd6cf341929f9a83591a4a4dc780cad87a113af0 Stats: 661 lines in 20 files changed: 497 ins; 96 del; 68 mod [hat][proposal] Adding notion of local thread ids and local group sizes int HAT ------------- PR: https://git.openjdk.org/babylon/pull/527 From duke at openjdk.org Wed Aug 20 08:25:59 2025 From: duke at openjdk.org (duke) Date: Wed, 20 Aug 2025 08:25:59 GMT Subject: [code-reflection] RFR: [samples] Apply type conversion for the int-shift function after the new result op has been built In-Reply-To: References: Message-ID: On Wed, 20 Aug 2025 08:17:48 GMT, Juan Fumero wrote: > This patch fixes the example suite for the `MathOptimizer` example for the integer function transformation. > > To me the transformation correct, we need to convert back from `int` to `double`: > > > newResult = blockBuilder.op(JavaOp.conv(JavaType.DOUBLE, newResult)); > > > How to test it? > > > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizer @jjfumero Your change (at version 89e0bdbfd0bc23169a6cde57d16c9137fcf66087) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/528#issuecomment-3204799577 From duke at openjdk.org Wed Aug 20 08:25:59 2025 From: duke at openjdk.org (Juan Fumero) Date: Wed, 20 Aug 2025 08:25:59 GMT Subject: [code-reflection] RFR: [samples] Apply type conversion for the int-shift function after the new result op has been built Message-ID: This patch fixes the example suite for the `MathOptimizer` example for the integer function transformation. To me the transformation correct, we need to convert back from `int` to `double`: newResult = blockBuilder.op(JavaOp.conv(JavaType.DOUBLE, newResult)); How to test it? java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizer ------------- Commit messages: - [samples] Apply type conversion for the int-shift function after the new result op has been built Changes: https://git.openjdk.org/babylon/pull/528/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=528&range=00 Stats: 21 lines in 3 files changed: 18 ins; 3 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/528.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/528/head:pull/528 PR: https://git.openjdk.org/babylon/pull/528 From psandoz at openjdk.org Wed Aug 20 15:05:20 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 20 Aug 2025 15:05:20 GMT Subject: git: openjdk/babylon: code-reflection: [samples] Apply type conversion for the int-shift function after the new result op has been built Message-ID: <0d67285e-0a92-41cf-9511-6decaa634673@openjdk.org> Changeset: 939aeaa8 Branch: code-reflection Author: Juan Fumero Committer: Paul Sandoz Date: 2025-08-20 15:03:21 +0000 URL: https://git.openjdk.org/babylon/commit/939aeaa815b6b43b5866f330cbf990102f050c30 [samples] Apply type conversion for the int-shift function after the new result op has been built ! cr-examples/samples/README.md ! cr-examples/samples/src/main/java/oracle/code/samples/MathOptimizer.java ! cr-examples/samples/src/main/java/oracle/code/samples/MathOptimizerWithInlining.java From duke at openjdk.org Wed Aug 20 15:07:13 2025 From: duke at openjdk.org (Juan Fumero) Date: Wed, 20 Aug 2025 15:07:13 GMT Subject: [code-reflection] Integrated: [samples] Apply type conversion for the int-shift function after the new result op has been built In-Reply-To: References: Message-ID: On Wed, 20 Aug 2025 08:17:48 GMT, Juan Fumero wrote: > This patch fixes the example suite for the `MathOptimizer` example for the integer function transformation. > > To me the transformation correct, we need to convert back from `int` to `double`: > > > newResult = blockBuilder.op(JavaOp.conv(JavaType.DOUBLE, newResult)); > > > How to test it? > > > java --enable-preview -cp target/crsamples-1.0-SNAPSHOT.jar oracle.code.samples.MathOptimizer This pull request has now been integrated. Changeset: 939aeaa8 Author: Juan Fumero Committer: Paul Sandoz URL: https://git.openjdk.org/babylon/commit/939aeaa815b6b43b5866f330cbf990102f050c30 Stats: 21 lines in 3 files changed: 18 ins; 3 del; 0 mod [samples] Apply type conversion for the int-shift function after the new result op has been built ------------- PR: https://git.openjdk.org/babylon/pull/528 From mabbay at openjdk.org Fri Aug 22 09:25:56 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 22 Aug 2025 09:25:56 GMT Subject: [code-reflection] RFR: Document quoteOp and quotedOp methods [v8] In-Reply-To: References: Message-ID: > Specify the behaviour of quoteOp and quotedOp methods. 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/512/files - new: https://git.openjdk.org/babylon/pull/512/files/34cc6a8f..01cbb329 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=07 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=06-07 Stats: 93 lines in 2 files changed: 22 ins; 45 del; 26 mod Patch: https://git.openjdk.org/babylon/pull/512.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/512/head:pull/512 PR: https://git.openjdk.org/babylon/pull/512 From gfrost at openjdk.org Fri Aug 22 10:29:07 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 22 Aug 2025 10:29:07 GMT Subject: git: openjdk/babylon: code-reflection: Stop intellij red-squiggling lambda parms called value Message-ID: <33dd84ce-ce4a-4446-b874-6d08a27512a3@openjdk.org> Changeset: c3b86bbe Branch: code-reflection Author: Gary Frost Date: 2025-08-22 10:28:17 +0000 URL: https://git.openjdk.org/babylon/commit/c3b86bbe1ad3c3f0b601ccc770d892e9d22ff34a Stop intellij red-squiggling lambda parms called value ! hat/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/intellij/example_nbody.iml From gfrost at openjdk.org Fri Aug 22 10:31:52 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 22 Aug 2025 10:31:52 GMT Subject: [code-reflection] Integrated: Stop intellij red-squiggling lambda parms called value Message-ID: <5wpnSjMCCwR62kEPK1EprU8BdtjecM0lvFaw2QcGBSQ=.45308ca2-3d5c-4573-b28f-e9f316e206b7@github.com> Intellij has started red-squiggling (reporting as errors) lambda params called value. Just renaming params here to get around this. ------------- Commit messages: - Stop intellij red-squiggling lambda parms called value Changes: https://git.openjdk.org/babylon/pull/530/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=530&range=00 Stats: 10 lines in 2 files changed: 1 ins; 0 del; 9 mod Patch: https://git.openjdk.org/babylon/pull/530.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/530/head:pull/530 PR: https://git.openjdk.org/babylon/pull/530 From gfrost at openjdk.org Fri Aug 22 10:31:53 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 22 Aug 2025 10:31:53 GMT Subject: [code-reflection] Integrated: Stop intellij red-squiggling lambda parms called value In-Reply-To: <5wpnSjMCCwR62kEPK1EprU8BdtjecM0lvFaw2QcGBSQ=.45308ca2-3d5c-4573-b28f-e9f316e206b7@github.com> References: <5wpnSjMCCwR62kEPK1EprU8BdtjecM0lvFaw2QcGBSQ=.45308ca2-3d5c-4573-b28f-e9f316e206b7@github.com> Message-ID: On Fri, 22 Aug 2025 10:26:34 GMT, Gary Frost wrote: > Intellij has started red-squiggling (reporting as errors) lambda params called value. > > Just renaming params here to get around this. This pull request has now been integrated. Changeset: c3b86bbe Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/c3b86bbe1ad3c3f0b601ccc770d892e9d22ff34a Stats: 10 lines in 2 files changed: 1 ins; 0 del; 9 mod Stop intellij red-squiggling lambda parms called value ------------- PR: https://git.openjdk.org/babylon/pull/530 From mabbay at openjdk.org Fri Aug 22 11:11:43 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 22 Aug 2025 11:11:43 GMT Subject: [code-reflection] RFR: Disallow insertion of a root op in a block [v9] In-Reply-To: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: > A root operation shouldn't be inserted in a block. This changes enforce this rule. 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/425/files - new: https://git.openjdk.org/babylon/pull/425/files/46147724..3a332897 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=08 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=07-08 Stats: 31 lines in 5 files changed: 4 ins; 3 del; 24 mod Patch: https://git.openjdk.org/babylon/pull/425.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/425/head:pull/425 PR: https://git.openjdk.org/babylon/pull/425 From psandoz at openjdk.org Fri Aug 22 17:00:19 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 22 Aug 2025 17:00:19 GMT Subject: [code-reflection] RFR: Rearrange lowering. Message-ID: Improve the composition of operation transformations for lowering. - An operation transformation function can be adapted to lower lowerable operations or copy, thereby we don't have to repeat that logic many times. - Composing transformer methods are moved to static methods, thereby better handling a null transformer. We compose with a given `OpTransformer` and a `BiFunction` that represents the transformation of operations. - The lowerable interface is simplified to just one method - An initiating lowerable transformation passes a null transformer when lowering a lowerable op. ------------- Commit messages: - Doc update - Doc update. - Refactoring. - Doc fix. - Merge remote-tracking branch 'upstream/code-reflection' into lowering - Rearrange lowering. Changes: https://git.openjdk.org/babylon/pull/529/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=529&range=00 Stats: 410 lines in 5 files changed: 101 ins; 180 del; 129 mod Patch: https://git.openjdk.org/babylon/pull/529.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/529/head:pull/529 PR: https://git.openjdk.org/babylon/pull/529 From psandoz at openjdk.org Fri Aug 22 19:40:25 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 22 Aug 2025 19:40:25 GMT Subject: git: openjdk/babylon: code-reflection: Rearrange lowering. Message-ID: <946356ac-65de-4eff-b508-c30c3354d5b9@openjdk.org> Changeset: 4a88aba6 Branch: code-reflection Author: Paul Sandoz Date: 2025-08-22 19:39:47 +0000 URL: https://git.openjdk.org/babylon/commit/4a88aba6599137f550bfcd13469ca9ebcc2c1ff2 Rearrange lowering. ! cr-examples/spirv/src/main/java/intel/code/spirv/TranslateToSpirvModel.java ! hat/core/src/main/java/hat/optools/FuncOpWrapper.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/OpTransformer.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java From psandoz at openjdk.org Fri Aug 22 19:43:13 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 22 Aug 2025 19:43:13 GMT Subject: [code-reflection] Integrated: Rearrange lowering. In-Reply-To: References: Message-ID: On Thu, 21 Aug 2025 22:53:38 GMT, Paul Sandoz wrote: > Improve the composition of operation transformations for lowering. > > - An operation transformation function can be adapted to lower lowerable operations or copy, thereby we don't have to repeat that logic many times. > - Composing transformer methods are moved to static methods, thereby better handling a null transformer. We compose with a given `OpTransformer` and a `BiFunction` that represents the transformation of operations. > - The lowerable interface is simplified to just one method > - An initiating lowerable transformation passes a null transformer when lowering a lowerable op. This pull request has now been integrated. Changeset: 4a88aba6 Author: Paul Sandoz URL: https://git.openjdk.org/babylon/commit/4a88aba6599137f550bfcd13469ca9ebcc2c1ff2 Stats: 410 lines in 5 files changed: 101 ins; 180 del; 129 mod Rearrange lowering. ------------- PR: https://git.openjdk.org/babylon/pull/529 From psandoz at openjdk.org Fri Aug 22 19:48:01 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 22 Aug 2025 19:48:01 GMT Subject: [code-reflection] RFR: Document quoteOp and quotedOp methods [v8] In-Reply-To: References: Message-ID: <1y7CErk6TA-TKa26Nwe4Uy2CiKT9p5OCS25jvMhusKU=.534a6555-7a34-4bdd-a899-a041b4042cfe@github.com> On Fri, 22 Aug 2025 09:25:56 GMT, Mourad Abbay wrote: >> Specify the behaviour of quoteOp and quotedOp methods. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Apply suggestions src/jdk.incubator.code/share/classes/jdk/incubator/code/Quoted.java line 332: > 330: /** > 331: * The varargs version of {@link #quotedOp(CoreOp.FuncOp, List)}. > 332: */ Copy the doc from the first method and add `@see` ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/512#discussion_r2294564549 From psandoz at openjdk.org Fri Aug 22 19:58:13 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 22 Aug 2025 19:58:13 GMT Subject: [code-reflection] RFR: Document quoteOp and quotedOp methods [v8] In-Reply-To: References: Message-ID: On Fri, 22 Aug 2025 09:25:56 GMT, Mourad Abbay wrote: >> Specify the behaviour of quoteOp and quotedOp methods. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Apply suggestions Looks good, please address the doc comment before integrating. Lets review the naming and follow up with another PR. I am inclined to think of this as embed and extract. - `quoteOp` is renamed to `embedOp`, as in embeds an operation into its quoted form. - `quotedOp` is renamed to `extractOp`, as in extracts an operation from its quoted form. That naming seems more evocative as to the mechanics. (Regardless of the names, both form an embedding-projection pair.) ------------- Marked as reviewed by psandoz (Lead). PR Review: https://git.openjdk.org/babylon/pull/512#pullrequestreview-3145735582 From psandoz at openjdk.org Fri Aug 22 20:19:07 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Fri, 22 Aug 2025 20:19:07 GMT Subject: [code-reflection] RFR: Disallow insertion of a root op in a block [v9] In-Reply-To: References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: On Fri, 22 Aug 2025 11:11:43 GMT, Mourad Abbay wrote: >> A root operation shouldn't be inserted in a block. This changes enforce this rule. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Apply suggestions The naming update looks good. We need to test this carefully before integrating. Noting down some terminology and behaviour. Operations have the following states: - unbound. The operation has no result, and therefore it has no parent (block). - bound. Appending an unbound operation to a block builder results in the operation being bound. The bound operation is assigned an operation result and has a parent block. The parent's block is only accessible once the block's parent body is built. - sealed. An unbound operation can be sealed. The operation has no result, and therefore no parent (block). Neither a bound or sealed operation can unbound. Appending a bound or sealed operation to a block builder results in it being transformed to a new unbound operation that is then appended. src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java line 173: > 171: * If assigned to an operation result, it indicates the operation is sealed > 172: */ > 173: private static final Result SEALED_OPR = new Result(); Suggestion: private static final Result SEALED_RESULT = new Result(); src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java line 546: > 544: } > 545: > 546: public void seal() { Document this method and `isSealed`. src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java line 551: > 549: } > 550: if (result != null) { > 551: throw new IllegalStateException("Can't freeze a bound operation"); Suggestion: throw new IllegalStateException("Operation cannot be sealed since it bound to a parent block"); src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java line 2779: > 2777: Assert.check(funcOp.body().blocks().size() == 1); > 2778: > 2779: Set mRefs = new HashSet<>(List.of(M_BLOCK_BUILDER_OP, M_BLOCK_BUILDER_PARAM, M_OP_SEAL)); This can be a static final field. See `Set.of`. ------------- PR Review: https://git.openjdk.org/babylon/pull/425#pullrequestreview-3145746932 PR Review Comment: https://git.openjdk.org/babylon/pull/425#discussion_r2294601003 PR Review Comment: https://git.openjdk.org/babylon/pull/425#discussion_r2294639430 PR Review Comment: https://git.openjdk.org/babylon/pull/425#discussion_r2294603709 PR Review Comment: https://git.openjdk.org/babylon/pull/425#discussion_r2294636191 From mabbay at openjdk.org Mon Aug 25 07:07:53 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Mon, 25 Aug 2025 07:07:53 GMT Subject: [code-reflection] RFR: Fix lambda bugs Message-ID: Fix lambda bugs: 1. Unnecessary load of static fields accessed inside the lambda body (bug 1). 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2). 3. Inner lambda is incorrectly quoted (bug 3). ------------- Commit messages: - Merge branch 'code-reflection' into lambda-bugs - Fix lambda bug 1 Changes: https://git.openjdk.org/babylon/pull/532/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=00 Stats: 4 lines in 1 file changed: 4 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/532.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/532/head:pull/532 PR: https://git.openjdk.org/babylon/pull/532 From mabbay at openjdk.org Mon Aug 25 08:57:31 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Mon, 25 Aug 2025 08:57:31 GMT Subject: [code-reflection] RFR: Fix lambda bugs [v2] In-Reply-To: References: Message-ID: > Fix lambda bugs: > 1. Unnecessary load of static fields accessed inside the lambda body (bug 1). > 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2). > 3. Inner lambda is incorrectly quoted (bug 3). Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Add test case to ensure bug 1 is fixed ------------- Changes: - all: https://git.openjdk.org/babylon/pull/532/files - new: https://git.openjdk.org/babylon/pull/532/files/c0c5ac8e..9c7b1108 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=00-01 Stats: 15 lines in 1 file changed: 15 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/532.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/532/head:pull/532 PR: https://git.openjdk.org/babylon/pull/532 From mabbay at openjdk.org Mon Aug 25 11:28:24 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Mon, 25 Aug 2025 11:28:24 GMT Subject: [code-reflection] RFR: Fix lambda bugs [v3] In-Reply-To: References: Message-ID: > Fix lambda bugs: > 1. Unnecessary load of static fields accessed inside the lambda body (bug 1). > 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2). > 3. Inner lambda is incorrectly quoted (bug 3). Mourad Abbay has updated the pull request incrementally with two additional commits since the last revision: - Fix bug 2 - Fix the bug of lambda model containing ReturnOp with value even though the lambda return type is void ------------- Changes: - all: https://git.openjdk.org/babylon/pull/532/files - new: https://git.openjdk.org/babylon/pull/532/files/9c7b1108..4cbb2bb5 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=02 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=01-02 Stats: 7 lines in 1 file changed: 4 ins; 0 del; 3 mod Patch: https://git.openjdk.org/babylon/pull/532.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/532/head:pull/532 PR: https://git.openjdk.org/babylon/pull/532 From psandoz at openjdk.org Mon Aug 25 21:26:58 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Mon, 25 Aug 2025 21:26:58 GMT Subject: [code-reflection] RFR: Fix lambda bugs [v3] In-Reply-To: References: Message-ID: On Mon, 25 Aug 2025 11:28:24 GMT, Mourad Abbay wrote: >> Fix lambda bugs: >> 1. Unnecessary load of static fields accessed inside the lambda body (bug 1). >> 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2). >> 3. Inner lambda is incorrectly quoted (bug 3). > > Mourad Abbay has updated the pull request incrementally with two additional commits since the last revision: > > - Fix bug 2 > - Fix the bug of lambda model containing ReturnOp with value even though the lambda return type is void Changes look good, but we should take care the change to `coerce` does not break anything. Are you going to add more tests covering the other fixes? ------------- PR Review: https://git.openjdk.org/babylon/pull/532#pullrequestreview-3153078039 From paul.sandoz at oracle.com Mon Aug 25 21:36:44 2025 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 25 Aug 2025 21:36:44 +0000 Subject: CFV: New Babylon Reviewer: Juan Fumero Message-ID: I hereby nominate Juan Fumero [1] to Babylon Reviewer [0]. Juan is a member of the Java Team at Oracle, has extensive experience in Java and GPUs, and is already contributing fixes and features to HAT, and examples of code reflection. Votes are due by September 9th, 2025. Only current Babylon Committers [2] are eligible to vote on this nomination. Votes must be cast in the open by replying to this mailing list. For Lazy Consensus voting instructions, see [3]. Paul. [0] Project Babylon does not currently make any distinction between Committer and Reviewer, and PRs are not required to be reviewed by Reviewers before integration. [1] https://openjdk.org/census#jfumero [2] https://openjdk.java.net/census [3] https://openjdk.org/projects/#committer-vote -------------- next part -------------- An HTML attachment was scrubbed... URL: From mabbay at openjdk.org Tue Aug 26 06:18:13 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 26 Aug 2025 06:18:13 GMT Subject: [code-reflection] RFR: Fix lambda bugs [v4] In-Reply-To: References: Message-ID: > Fix lambda bugs: > 1. Unnecessary load of static fields accessed inside the lambda body (bug 1). > 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2). > 3. Inner lambda is incorrectly quoted (bug 3). Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Add test cases to ensure bug 2 is fixed ------------- Changes: - all: https://git.openjdk.org/babylon/pull/532/files - new: https://git.openjdk.org/babylon/pull/532/files/4cbb2bb5..c8b2dead Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=03 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=02-03 Stats: 30 lines in 1 file changed: 30 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/532.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/532/head:pull/532 PR: https://git.openjdk.org/babylon/pull/532 From mabbay at openjdk.org Tue Aug 26 10:50:13 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Tue, 26 Aug 2025 10:50:13 GMT Subject: [code-reflection] RFR: Fix lambda bugs [v5] In-Reply-To: References: Message-ID: > Fix lambda bugs: > 1. Unnecessary load of static fields accessed inside the lambda body (bug 1). > 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2). > 3. Inner lambda is incorrectly quoted (bug 3). Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Fix bug 3 ------------- Changes: - all: https://git.openjdk.org/babylon/pull/532/files - new: https://git.openjdk.org/babylon/pull/532/files/c8b2dead..0e89387c Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=04 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=03-04 Stats: 42 lines in 2 files changed: 39 ins; 0 del; 3 mod Patch: https://git.openjdk.org/babylon/pull/532.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/532/head:pull/532 PR: https://git.openjdk.org/babylon/pull/532 From paul.sandoz at oracle.com Tue Aug 26 16:07:35 2025 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 26 Aug 2025 16:07:35 +0000 Subject: CFV: New Babylon Reviewer: Juan Fumero In-Reply-To: References: Message-ID: <98DD8814-84B2-44EA-B70A-B519B91E4408@oracle.com> Vote: yes Paul. On Aug 25, 2025, at 2:36?PM, Paul Sandoz wrote: I hereby nominate Juan Fumero [1] to Babylon Reviewer [0]. Juan is a member of the Java Team at Oracle, has extensive experience in Java and GPUs, and is already contributing fixes and features to HAT, and examples of code reflection. Votes are due by September 9th, 2025. Only current Babylon Committers [2] are eligible to vote on this nomination. Votes must be cast in the open by replying to this mailing list. For Lazy Consensus voting instructions, see [3]. Paul. [0] Project Babylon does not currently make any distinction between Committer and Reviewer, and PRs are not required to be reviewed by Reviewers before integration. [1] https://openjdk.org/census#jfumero [2] https://openjdk.java.net/census [3] https://openjdk.org/projects/#committer-vote -------------- next part -------------- An HTML attachment was scrubbed... URL: From psandoz at openjdk.org Tue Aug 26 18:27:58 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Tue, 26 Aug 2025 18:27:58 GMT Subject: [code-reflection] RFR: Fix lambda bugs [v5] In-Reply-To: References: Message-ID: On Tue, 26 Aug 2025 10:50:13 GMT, Mourad Abbay wrote: >> Fix lambda bugs: >> 1. Unnecessary load of static fields accessed inside the lambda body (bug 1). >> 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2). >> 3. Inner lambda is incorrectly quoted (bug 3). > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Fix bug 3 test/langtools/tools/javac/reflect/QuotableSubtypeTest.java line 328: > 326: }; > 327: """) > 328: // @@@ should this be the excepted behaviour in case we have a nested quotable lambda ? Yes, the program behavior is to produce an instance of a functional interface whose implementation is bound to the lambda's body. Because the lambda is also targeted to a `Quotable` interface, there is additional program behaviour that gives access to the code model of the lambda via a corresponding Quoted instance. ------------- PR Review Comment: https://git.openjdk.org/babylon/pull/532#discussion_r2301788256 From mabbay at openjdk.org Wed Aug 27 00:48:25 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 27 Aug 2025 00:48:25 GMT Subject: [code-reflection] RFR: Fix lambda bugs [v6] In-Reply-To: References: Message-ID: > Fix lambda bugs: > 1. Unnecessary load of static fields accessed inside the lambda body (bug 1). > 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2). > 3. Inner lambda is incorrectly quoted (bug 3). Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Clarify comment ------------- Changes: - all: https://git.openjdk.org/babylon/pull/532/files - new: https://git.openjdk.org/babylon/pull/532/files/0e89387c..815e5f9f Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=05 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=04-05 Stats: 7 lines in 1 file changed: 2 ins; 0 del; 5 mod Patch: https://git.openjdk.org/babylon/pull/532.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/532/head:pull/532 PR: https://git.openjdk.org/babylon/pull/532 From mabbay at openjdk.org Wed Aug 27 01:01:07 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 27 Aug 2025 01:01:07 GMT Subject: git: openjdk/babylon: code-reflection: Document quoteOp and quotedOp methods Message-ID: Changeset: 028d2bcd Branch: code-reflection Author: Mourad Abbay Date: 2025-08-27 01:00:07 +0000 URL: https://git.openjdk.org/babylon/commit/028d2bcd3b05407dd81ffaf86c8ef4273a206eb7 Document quoteOp and quotedOp methods Reviewed-by: psandoz ! src/jdk.incubator.code/share/classes/jdk/incubator/code/Quoted.java ! test/jdk/java/lang/reflect/code/TestQuoteOp.java From mabbay at openjdk.org Wed Aug 27 01:05:25 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 27 Aug 2025 01:05:25 GMT Subject: [code-reflection] RFR: Document quoteOp and quotedOp methods [v9] In-Reply-To: References: Message-ID: > Specify the behaviour of quoteOp and quotedOp methods. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Document Quoted.quotedOp(FuncOp, Object...) ------------- Changes: - all: https://git.openjdk.org/babylon/pull/512/files - new: https://git.openjdk.org/babylon/pull/512/files/01cbb329..a8653ae4 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=08 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=512&range=07-08 Stats: 12 lines in 1 file changed: 11 ins; 0 del; 1 mod Patch: https://git.openjdk.org/babylon/pull/512.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/512/head:pull/512 PR: https://git.openjdk.org/babylon/pull/512 From mabbay at openjdk.org Wed Aug 27 01:05:26 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 27 Aug 2025 01:05:26 GMT Subject: [code-reflection] Integrated: Document quoteOp and quotedOp methods In-Reply-To: References: Message-ID: On Tue, 5 Aug 2025 21:17:32 GMT, Mourad Abbay wrote: > Specify the behaviour of quoteOp and quotedOp methods. This pull request has now been integrated. Changeset: 028d2bcd Author: Mourad Abbay URL: https://git.openjdk.org/babylon/commit/028d2bcd3b05407dd81ffaf86c8ef4273a206eb7 Stats: 251 lines in 2 files changed: 215 ins; 7 del; 29 mod Document quoteOp and quotedOp methods Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/512 From mabbay at openjdk.org Wed Aug 27 01:38:37 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 27 Aug 2025 01:38:37 GMT Subject: [code-reflection] RFR: Rename quoteOp and quotedOp Message-ID: Rename quoteOp to embedOp and quotedOp to extractOp. ------------- Commit messages: - Rename quoteOp to embedOp and quotedOp to extractOp Changes: https://git.openjdk.org/babylon/pull/533/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=533&range=00 Stats: 24 lines in 6 files changed: 0 ins; 0 del; 24 mod Patch: https://git.openjdk.org/babylon/pull/533.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/533/head:pull/533 PR: https://git.openjdk.org/babylon/pull/533 From mabbay at openjdk.org Wed Aug 27 01:55:04 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 27 Aug 2025 01:55:04 GMT Subject: [code-reflection] RFR: Disallow insertion of a root op in a block [v10] In-Reply-To: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: <2nEcwuUa3_i9onlZTxMTB9bd9BdRVTz9Q9BAMKEiKgg=.276a97cb-3593-41e7-bf45-4292446275b4@github.com> > A root operation shouldn't be inserted in a block. This changes enforce this rule. 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/425/files - new: https://git.openjdk.org/babylon/pull/425/files/3a332897..52f6154c Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=09 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=08-09 Stats: 8 lines in 2 files changed: 1 ins; 1 del; 6 mod Patch: https://git.openjdk.org/babylon/pull/425.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/425/head:pull/425 PR: https://git.openjdk.org/babylon/pull/425 From maurizio.cimadamore at oracle.com Wed Aug 27 09:54:41 2025 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Wed, 27 Aug 2025 10:54:41 +0100 Subject: CFV: New Babylon Reviewer: Juan Fumero In-Reply-To: References: Message-ID: <11146016-d320-4b88-a9c7-e861bf569c86@oracle.com> Vote: yes! Maurizio On 25/08/2025 22:36, Paul Sandoz wrote: > I hereby nominate Juan Fumero [1] to Babylon Reviewer [0]. > > Juan?is a member of the Java Team at Oracle, has extensive experience > in Java and GPUs, and is already contributing fixes and features to > HAT, and examples of code reflection. > > Votes are due by September 9th, 2025. > > Only current Babylon Committers [2] are eligible to vote on this > nomination. Votes must be cast in the open by replying to this mailing > list. > > For Lazy Consensus voting instructions, see [3]. > > Paul. > > [0] Project Babylon does not currently make any distinction between > Committer and Reviewer, and PRs are not required to be reviewed by > Reviewers before integration. > [1] https://openjdk.org/census#jfumero > [2] https://openjdk.java.net/census > [3] https://openjdk.org/projects/#committer-vote From gary.frost at oracle.com Wed Aug 27 10:28:58 2025 From: gary.frost at oracle.com (Gary Frost) Date: Wed, 27 Aug 2025 10:28:58 +0000 Subject: CFV: New Babylon Reviewer: Juan Fumero In-Reply-To: <11146016-d320-4b88-a9c7-e861bf569c86@oracle.com> References: <11146016-d320-4b88-a9c7-e861bf569c86@oracle.com> Message-ID: Vote: Yes Gary ________________________________ From: babylon-dev on behalf of Maurizio Cimadamore Sent: Wednesday, August 27, 2025 10:54 AM To: Paul Sandoz ; babylon-dev at openjdk.org Subject: Re: CFV: New Babylon Reviewer: Juan Fumero Vote: yes! Maurizio On 25/08/2025 22:36, Paul Sandoz wrote: > I hereby nominate Juan Fumero [1] to Babylon Reviewer [0]. > > Juan is a member of the Java Team at Oracle, has extensive experience > in Java and GPUs, and is already contributing fixes and features to > HAT, and examples of code reflection. > > Votes are due by September 9th, 2025. > > Only current Babylon Committers [2] are eligible to vote on this > nomination. Votes must be cast in the open by replying to this mailing > list. > > For Lazy Consensus voting instructions, see [3]. > > Paul. > > [0] Project Babylon does not currently make any distinction between > Committer and Reviewer, and PRs are not required to be reviewed by > Reviewers before integration. > [1] https://openjdk.org/census#jfumero > [2] https://openjdk.java.net/census > [3] https://openjdk.org/projects/#committer-vote -------------- next part -------------- An HTML attachment was scrubbed... URL: From mabbay at openjdk.org Wed Aug 27 11:21:17 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 27 Aug 2025 11:21:17 GMT Subject: [code-reflection] RFR: Disallow insertion of a root op in a block [v11] In-Reply-To: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: <0HTNOKCwXPPKUn2Y1bomQqd1BiGuF5cPG2Vg3TbCtuo=.c90057c0-a315-4b47-9723-e2885cdabfb1@github.com> > A root operation shouldn't be inserted in a block. This changes enforce this rule. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Document Op.seal and Op.isSealed ------------- Changes: - all: https://git.openjdk.org/babylon/pull/425/files - new: https://git.openjdk.org/babylon/pull/425/files/52f6154c..bb551fc4 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=10 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=09-10 Stats: 11 lines in 1 file changed: 11 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/425.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/425/head:pull/425 PR: https://git.openjdk.org/babylon/pull/425 From jfumero at openjdk.org Wed Aug 27 13:18:45 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 27 Aug 2025 13:18:45 GMT Subject: [code-reflection] RFR: [hat] Enable padding in the codegen as an option for the iFace types and Schemas Message-ID: This PR extends the C99 code generator to allow the generation of padding if this option is specified in the Hat Data Type Schema. For instance: Schema schema = Schema.of(F32Array.class, f32Array->f32Array .arrayLen("length").pad(12).array("array")); Generates this C99 struct: typedef struct F32Array_s{ int length; char pad$ZArmN[12]; // pad$ + 5 random letter to avoid accidental collision with other members of the buffer type float array[1]; }F32Array_t; This change is required to enable efficient local memory: See https://github.com/openjdk/babylon/pull/531 ------------- Commit messages: - [hat] Disable padding for F32Array - [hat] Enable padding for iFace schemas in the C99 codegen Changes: https://git.openjdk.org/babylon/pull/534/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=534&range=00 Stats: 29 lines in 2 files changed: 27 ins; 0 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/534.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/534/head:pull/534 PR: https://git.openjdk.org/babylon/pull/534 From duke at openjdk.org Wed Aug 27 13:18:45 2025 From: duke at openjdk.org (duke) Date: Wed, 27 Aug 2025 13:18:45 GMT Subject: [code-reflection] RFR: [hat] Enable padding in the codegen as an option for the iFace types and Schemas In-Reply-To: References: Message-ID: <9B5zkjyYAQc-TT-P23PhzNbyXXmFdIrmM3nsFoqA2OA=.3576d7f7-32e8-470b-a8e6-a80c173966eb@github.com> On Wed, 27 Aug 2025 13:10:25 GMT, Juan Fumero wrote: > This PR extends the C99 code generator to allow the generation of padding if this option is specified in the Hat Data Type Schema. > > For instance: > > > Schema schema = Schema.of(F32Array.class, f32Array->f32Array > .arrayLen("length").pad(12).array("array")); > > > Generates this C99 struct: > > > typedef struct F32Array_s{ > int length; > char pad$ZArmN[12]; // pad$ + 5 random letter to avoid accidental collision with other members of the buffer type > float array[1]; > }F32Array_t; > > > This change is required to enable efficient local memory: See https://github.com/openjdk/babylon/pull/531 @jjfumero Your change (at version a1fc95af12d2c5a75640f068395a57ea76ff555f) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/babylon/pull/534#issuecomment-3228161833 From gfrost at openjdk.org Wed Aug 27 13:48:44 2025 From: gfrost at openjdk.org (Gary Frost) Date: Wed, 27 Aug 2025 13:48:44 GMT Subject: git: openjdk/babylon: code-reflection: [hat] Enable padding in the codegen as an option for the iFace types and Schemas Message-ID: <8833c7dc-437e-4b81-bd1a-cb2e327dac83@openjdk.org> Changeset: cad3fdf3 Branch: code-reflection Author: Juan Fumero Committer: Gary Frost Date: 2025-08-27 13:47:53 +0000 URL: https://git.openjdk.org/babylon/commit/cad3fdf3d76bee4d6e9f34f66cce5b6524fd6c16 [hat] Enable padding in the codegen as an option for the iFace types and Schemas ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilderWithContext.java ! hat/core/src/main/java/hat/ifacemapper/Schema.java From jfumero at openjdk.org Wed Aug 27 13:51:05 2025 From: jfumero at openjdk.org (Juan Fumero) Date: Wed, 27 Aug 2025 13:51:05 GMT Subject: [code-reflection] Integrated: [hat] Enable padding in the codegen as an option for the iFace types and Schemas In-Reply-To: References: Message-ID: On Wed, 27 Aug 2025 13:10:25 GMT, Juan Fumero wrote: > This PR extends the C99 code generator to allow the generation of padding if this option is specified in the Hat Data Type Schema. > > For instance: > > > Schema schema = Schema.of(F32Array.class, f32Array->f32Array > .arrayLen("length").pad(12).array("array")); > > > Generates this C99 struct: > > > typedef struct F32Array_s{ > int length; > char pad$ZArmN[12]; // pad$ + 5 random letter to avoid accidental collision with other members of the buffer type > float array[1]; > }F32Array_t; > > > This change is required to enable efficient local memory: See https://github.com/openjdk/babylon/pull/531 This pull request has now been integrated. Changeset: cad3fdf3 Author: Juan Fumero Committer: Gary Frost URL: https://git.openjdk.org/babylon/commit/cad3fdf3d76bee4d6e9f34f66cce5b6524fd6c16 Stats: 29 lines in 2 files changed: 27 ins; 0 del; 2 mod [hat] Enable padding in the codegen as an option for the iFace types and Schemas ------------- PR: https://git.openjdk.org/babylon/pull/534 From mabbay at openjdk.org Wed Aug 27 14:41:06 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Wed, 27 Aug 2025 14:41:06 GMT Subject: [code-reflection] RFR: Enable sealing of an operation [v11] In-Reply-To: <0HTNOKCwXPPKUn2Y1bomQqd1BiGuF5cPG2Vg3TbCtuo=.c90057c0-a315-4b47-9723-e2885cdabfb1@github.com> References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> <0HTNOKCwXPPKUn2Y1bomQqd1BiGuF5cPG2Vg3TbCtuo=.c90057c0-a315-4b47-9723-e2885cdabfb1@github.com> Message-ID: On Wed, 27 Aug 2025 11:21:17 GMT, Mourad Abbay wrote: >> Allow for an unbound operation to be sealed, causing it to be copied when we append it to a block builder. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Document Op.seal and Op.isSealed I run HAT examples and ONNX tests, all good. ------------- PR Comment: https://git.openjdk.org/babylon/pull/425#issuecomment-3228478133 From psandoz at openjdk.org Wed Aug 27 15:51:59 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Wed, 27 Aug 2025 15:51:59 GMT Subject: [code-reflection] RFR: Enable sealing of an operation [v11] In-Reply-To: <0HTNOKCwXPPKUn2Y1bomQqd1BiGuF5cPG2Vg3TbCtuo=.c90057c0-a315-4b47-9723-e2885cdabfb1@github.com> References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> <0HTNOKCwXPPKUn2Y1bomQqd1BiGuF5cPG2Vg3TbCtuo=.c90057c0-a315-4b47-9723-e2885cdabfb1@github.com> Message-ID: On Wed, 27 Aug 2025 11:21:17 GMT, Mourad Abbay wrote: >> Allow for an unbound operation to be sealed, causing it to be copied when we append it to a block builder. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Document Op.seal and Op.isSealed See also the `setLocation` method. src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java line 313: > 311: @Override > 312: public final Block parent() { > 313: if (isSealed() || result == null) { Update the doc. src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java line 550: > 548: * and causes the operation to be copied when we append it to a {@link Block.Builder}. > 549: * @throws IllegalStateException If this operation is bound. > 550: * @implSpec This implementation is idempotent. Suggested doc: Seals this operation. After this operation is sealed its {@link #result result} and {@link #parent parent} are guaranteed to always be {@code null}.

If a sealed operation is {@link Block.Builder#op appended} to a {@link Block.Builder} then it is treated as if the operation is bound, and therefore the sealed operation will be transformed.

Sealing is idempotent if the operation is already sealed. @throws IllegalStateException if this operation is bound. Use of `@implSpec` is not required, idempotency is a property of the API specification and not the implementation specification. ------------- PR Review: https://git.openjdk.org/babylon/pull/425#pullrequestreview-3160419258 PR Review Comment: https://git.openjdk.org/babylon/pull/425#discussion_r2304383504 PR Review Comment: https://git.openjdk.org/babylon/pull/425#discussion_r2304420708 From mabbay at openjdk.org Thu Aug 28 15:18:28 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Thu, 28 Aug 2025 15:18:28 GMT Subject: [code-reflection] RFR: Enable sealing of an operation [v12] In-Reply-To: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: > Allow for an unbound operation to be sealed, causing it to be copied when we append it to a block builder. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Apply review comments ------------- Changes: - all: https://git.openjdk.org/babylon/pull/425/files - new: https://git.openjdk.org/babylon/pull/425/files/bb551fc4..15cc22f4 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=11 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=10-11 Stats: 20 lines in 2 files changed: 12 ins; 0 del; 8 mod Patch: https://git.openjdk.org/babylon/pull/425.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/425/head:pull/425 PR: https://git.openjdk.org/babylon/pull/425 From psandoz at openjdk.org Thu Aug 28 16:18:06 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 28 Aug 2025 16:18:06 GMT Subject: [code-reflection] RFR: Enable sealing of an operation [v12] In-Reply-To: References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: On Thu, 28 Aug 2025 15:18:28 GMT, Mourad Abbay wrote: >> Allow for an unbound operation to be sealed, causing it to be copied when we append it to a block builder. > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Apply review comments Marked as reviewed by psandoz (Lead). ------------- PR Review: https://git.openjdk.org/babylon/pull/425#pullrequestreview-3165580492 From psandoz at openjdk.org Thu Aug 28 16:40:54 2025 From: psandoz at openjdk.org (Paul Sandoz) Date: Thu, 28 Aug 2025 16:40:54 GMT Subject: [code-reflection] RFR: Fix lambda bugs [v6] In-Reply-To: References: Message-ID: On Wed, 27 Aug 2025 00:48:25 GMT, Mourad Abbay wrote: >> Fix lambda bugs: >> 1. Unnecessary load of static fields accessed inside the lambda body (bug 1). >> 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2). >> 3. Inner lambda is incorrectly quoted (bug 3). > > Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: > > Clarify comment Marked as reviewed by psandoz (Lead). ------------- PR Review: https://git.openjdk.org/babylon/pull/532#pullrequestreview-3165665896 From mabbay at openjdk.org Fri Aug 29 08:34:20 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 08:34:20 GMT Subject: [code-reflection] RFR: Enable sealing of an operation [v13] In-Reply-To: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: > Allow for an unbound operation to be sealed, causing it to be copied when we append it to a block builder. Mourad Abbay has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits: - Merge branch 'code-reflection' into root-op-insertion - Apply review comments - Document Op.seal and Op.isSealed - Apply suggestions - Apply suggestions - Update TestFreezeOp as result of API change - Merge branch 'code-reflection' into root-op-insertion # Conflicts: # src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java # src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/OpBuilder.java - Test that freezing an already bound op, throws - Test that structural quoted lambda are frozen - Update method Op.parentBlock to take into account frozen operations - ... and 8 more: https://git.openjdk.org/babylon/compare/cad3fdf3...4d220704 ------------- Changes: https://git.openjdk.org/babylon/pull/425/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=12 Stats: 149 lines in 5 files changed: 136 ins; 2 del; 11 mod Patch: https://git.openjdk.org/babylon/pull/425.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/425/head:pull/425 PR: https://git.openjdk.org/babylon/pull/425 From mabbay at openjdk.org Fri Aug 29 14:31:04 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 14:31:04 GMT Subject: git: openjdk/babylon: code-reflection: Enable sealing of an operation Message-ID: Changeset: f37da862 Branch: code-reflection Author: Mourad Abbay Date: 2025-08-29 14:26:57 +0000 URL: https://git.openjdk.org/babylon/commit/f37da86219dc51d166e5464023bda50a10c096d0 Enable sealing of an operation Reviewed-by: psandoz ! src/jdk.incubator.code/share/classes/jdk/incubator/code/Block.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.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/TestSealOp.java From mabbay at openjdk.org Fri Aug 29 14:32:19 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 14:32:19 GMT Subject: [code-reflection] RFR: Enable sealing of an operation [v14] In-Reply-To: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: > Allow for an unbound operation to be sealed, causing it to be copied when we append it to a block builder. Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Add an import that was deleted during merge with code-reflection ------------- Changes: - all: https://git.openjdk.org/babylon/pull/425/files - new: https://git.openjdk.org/babylon/pull/425/files/4d220704..1ccd2389 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=13 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=425&range=12-13 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.org/babylon/pull/425.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/425/head:pull/425 PR: https://git.openjdk.org/babylon/pull/425 From mabbay at openjdk.org Fri Aug 29 14:32:20 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 14:32:20 GMT Subject: [code-reflection] RFR: Enable sealing of an operation [v13] In-Reply-To: References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: On Fri, 29 Aug 2025 08:34:20 GMT, Mourad Abbay wrote: >> Allow for an unbound operation to be sealed, causing it to be copied when we append it to a block builder. > > Mourad Abbay has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits: > > - Merge branch 'code-reflection' into root-op-insertion > - Apply review comments > - Document Op.seal and Op.isSealed > - Apply suggestions > - Apply suggestions > - Update TestFreezeOp as result of API change > - Merge branch 'code-reflection' into root-op-insertion > > # Conflicts: > # src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java > # src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/OpBuilder.java > - Test that freezing an already bound op, throws > - Test that structural quoted lambda are frozen > - Update method Op.parentBlock to take into account frozen operations > - ... and 8 more: https://git.openjdk.org/babylon/compare/cad3fdf3...4d220704 I merged with code-reflection, run HAT examples and ONNX tests, everything run without errors. ------------- PR Comment: https://git.openjdk.org/babylon/pull/425#issuecomment-3237220645 From mabbay at openjdk.org Fri Aug 29 14:32:21 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 14:32:21 GMT Subject: [code-reflection] Integrated: Enable sealing of an operation In-Reply-To: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> References: <8sB7qlbnONF4wEI39cUCoik0sXf2Oj8NV7TsJ-ZbDWA=.a4cd10a1-ef17-4170-8697-4fd15557b568@github.com> Message-ID: On Mon, 12 May 2025 21:42:35 GMT, Mourad Abbay wrote: > Allow for an unbound operation to be sealed, causing it to be copied when we append it to a block builder. This pull request has now been integrated. Changeset: f37da862 Author: Mourad Abbay URL: https://git.openjdk.org/babylon/commit/f37da86219dc51d166e5464023bda50a10c096d0 Stats: 148 lines in 5 files changed: 136 ins; 1 del; 11 mod Enable sealing of an operation Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/425 From gfrost at openjdk.org Fri Aug 29 15:49:02 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 29 Aug 2025 15:49:02 GMT Subject: git: openjdk/babylon: code-reflection: Removing OpWrappers 1 of many Message-ID: <06b7f07c-d526-45c3-b7ca-5a7ca05e2b98@openjdk.org> Changeset: 92b4f42a Branch: code-reflection Author: Gary Frost Date: 2025-08-29 15:46:31 +0000 URL: https://git.openjdk.org/babylon/commit/92b4f42ab45f12bd7ca029d6b2f8838068eb9529 Removing OpWrappers 1 of many ! 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/C99FFIBackend.java ! hat/backends/ffi/shared/src/main/java/hat/backend/ffi/FFIBackend.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/backends/jextracted/shared/src/main/java/hat/backend/jextracted/JExtractedBackend.java ! hat/core/src/main/java/hat/OpsAndTypes.java ! hat/core/src/main/java/hat/backend/DebugBackend.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/C99HATComputeBuilder.java ! hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilder.java + hat/core/src/main/java/hat/codebuilders/HATCodeBuilderContext.java ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilderWithContext.java ! hat/core/src/main/java/hat/optools/BinaryOpWrapper.java ! hat/core/src/main/java/hat/optools/BodyWrapper.java ! hat/core/src/main/java/hat/optools/ConvOpWrapper.java ! hat/core/src/main/java/hat/optools/FieldAccessOpWrapper.java ! hat/core/src/main/java/hat/optools/ForOpWrapper.java ! hat/core/src/main/java/hat/optools/FuncCallOpWrapper.java ! hat/core/src/main/java/hat/optools/FuncOpWrapper.java ! hat/core/src/main/java/hat/optools/IfOpWrapper.java ! hat/core/src/main/java/hat/optools/InvokeOpWrapper.java ! hat/core/src/main/java/hat/optools/LambdaOpWrapper.java ! hat/core/src/main/java/hat/optools/LogicalOpWrapper.java ! hat/core/src/main/java/hat/optools/ModuleOpWrapper.java ! hat/core/src/main/java/hat/optools/OpWrapper.java ! hat/core/src/main/java/hat/optools/RootSet.java ! hat/core/src/main/java/hat/optools/TernaryOpWrapper.java ! hat/core/src/main/java/hat/optools/VarAccessOpWrapper.java ! hat/core/src/main/java/hat/optools/VarOpWrapper.java ! hat/core/src/main/java/hat/optools/WhileOpWrapper.java ! hat/intellij/wrap_opengl.iml ! hat/tools/src/main/java/hat/tools/jdot/ui/JDot.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 Fri Aug 29 15:49:23 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 29 Aug 2025 15:49:23 GMT Subject: [code-reflection] Integrated: Removing OpWrappers 1 of many Message-ID: In HAT we wrap babylon ops to minimize churn as the core API's change. As the code model API has stabalized, we should dismantal these. This is the first step. Refactoring some low OpWrapper calls with raw CodeModel calls. ------------- Commit messages: - Removing OpWrappers 1 of many Changes: https://git.openjdk.org/babylon/pull/535/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=535&range=00 Stats: 1149 lines in 40 files changed: 360 ins; 433 del; 356 mod Patch: https://git.openjdk.org/babylon/pull/535.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/535/head:pull/535 PR: https://git.openjdk.org/babylon/pull/535 From gfrost at openjdk.org Fri Aug 29 15:49:23 2025 From: gfrost at openjdk.org (Gary Frost) Date: Fri, 29 Aug 2025 15:49:23 GMT Subject: [code-reflection] Integrated: Removing OpWrappers 1 of many In-Reply-To: References: Message-ID: On Fri, 29 Aug 2025 15:43:55 GMT, Gary Frost wrote: > In HAT we wrap babylon ops to minimize churn as the core API's change. As the code model API has stabalized, we should dismantal these. > > This is the first step. Refactoring some low OpWrapper calls with raw CodeModel calls. This pull request has now been integrated. Changeset: 92b4f42a Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/92b4f42ab45f12bd7ca029d6b2f8838068eb9529 Stats: 1149 lines in 40 files changed: 360 ins; 433 del; 356 mod Removing OpWrappers 1 of many ------------- PR: https://git.openjdk.org/babylon/pull/535 From mabbay at openjdk.org Fri Aug 29 21:21:15 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 21:21:15 GMT Subject: [code-reflection] RFR: Fix lambda bugs [v7] In-Reply-To: References: Message-ID: > Fix lambda bugs: > 1. Unnecessary load of static fields accessed inside the lambda body (bug 1). > 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2). > 3. Inner lambda is incorrectly quoted (bug 3). Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision: Apply review comments ------------- Changes: - all: https://git.openjdk.org/babylon/pull/532/files - new: https://git.openjdk.org/babylon/pull/532/files/815e5f9f..23f1914c Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=06 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=05-06 Stats: 9 lines in 1 file changed: 6 ins; 0 del; 3 mod Patch: https://git.openjdk.org/babylon/pull/532.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/532/head:pull/532 PR: https://git.openjdk.org/babylon/pull/532 From mabbay at openjdk.org Fri Aug 29 21:33:42 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 21:33:42 GMT Subject: git: openjdk/babylon: code-reflection: Fix lambda bugs Message-ID: Changeset: 58083628 Branch: code-reflection Author: Mourad Abbay Date: 2025-08-29 21:32:59 +0000 URL: https://git.openjdk.org/babylon/commit/58083628b0caa0d16fde48af1fa18df7edc8dc59 Fix lambda bugs Reviewed-by: psandoz ! src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java ! test/langtools/tools/javac/reflect/QuotableSubtypeTest.java From mabbay at openjdk.org Fri Aug 29 21:36:15 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 21:36:15 GMT Subject: [code-reflection] RFR: Fix lambda bugs [v8] In-Reply-To: References: Message-ID: > Fix lambda bugs: > 1. Unnecessary load of static fields accessed inside the lambda body (bug 1). > 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2). > 3. Inner lambda is incorrectly quoted (bug 3). 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 10 additional commits since the last revision: - Merge branch 'code-reflection' into lambda-bugs - Apply review comments - Clarify comment - Fix bug 3 - Add test cases to ensure bug 2 is fixed - Fix bug 2 - Fix the bug of lambda model containing ReturnOp with value even though the lambda return type is void - Add test case to ensure bug 1 is fixed - Merge branch 'code-reflection' into lambda-bugs - Fix lambda bug 1 ------------- Changes: - all: https://git.openjdk.org/babylon/pull/532/files - new: https://git.openjdk.org/babylon/pull/532/files/23f1914c..77f2c779 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=07 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=532&range=06-07 Stats: 1577 lines in 48 files changed: 738 ins; 441 del; 398 mod Patch: https://git.openjdk.org/babylon/pull/532.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/532/head:pull/532 PR: https://git.openjdk.org/babylon/pull/532 From mabbay at openjdk.org Fri Aug 29 21:36:15 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 21:36:15 GMT Subject: [code-reflection] Integrated: Fix lambda bugs In-Reply-To: References: Message-ID: On Mon, 25 Aug 2025 06:56:35 GMT, Mourad Abbay wrote: > Fix lambda bugs: > 1. Unnecessary load of static fields accessed inside the lambda body (bug 1). > 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2). > 3. Inner lambda is incorrectly quoted (bug 3). This pull request has now been integrated. Changeset: 58083628 Author: Mourad Abbay URL: https://git.openjdk.org/babylon/commit/58083628b0caa0d16fde48af1fa18df7edc8dc59 Stats: 106 lines in 2 files changed: 100 ins; 0 del; 6 mod Fix lambda bugs Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/babylon/pull/532 From mabbay at openjdk.org Fri Aug 29 21:51:30 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 21:51:30 GMT Subject: git: openjdk/babylon: code-reflection: Rename quoteOp and quotedOp Message-ID: <6aa078c9-2aa8-4915-b9f7-404c65a3305a@openjdk.org> Changeset: d82b1346 Branch: code-reflection Author: Mourad Abbay Date: 2025-08-29 21:50:01 +0000 URL: https://git.openjdk.org/babylon/commit/d82b1346811fe9183924d09fae2a2a93e9b53bb7 Rename quoteOp and quotedOp ! src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/Quoted.java ! src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/BytecodeGenerator.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 ! test/jdk/java/lang/reflect/code/TestQuoteOp.java From mabbay at openjdk.org Fri Aug 29 21:55:40 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 21:55:40 GMT Subject: [code-reflection] Integrated: Rename quoteOp and quotedOp In-Reply-To: References: Message-ID: On Wed, 27 Aug 2025 01:31:26 GMT, Mourad Abbay wrote: > Rename quoteOp to embedOp and quotedOp to extractOp. This pull request has now been integrated. Changeset: d82b1346 Author: Mourad Abbay URL: https://git.openjdk.org/babylon/commit/d82b1346811fe9183924d09fae2a2a93e9b53bb7 Stats: 26 lines in 6 files changed: 0 ins; 0 del; 26 mod Rename quoteOp and quotedOp ------------- PR: https://git.openjdk.org/babylon/pull/533 From mabbay at openjdk.org Fri Aug 29 21:55:40 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 21:55:40 GMT Subject: [code-reflection] RFR: Rename quoteOp and quotedOp [v2] In-Reply-To: References: Message-ID: > Rename quoteOp to embedOp and quotedOp to extractOp. 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 three additional commits since the last revision: - Merge branch 'code-reflection' into rename-quoteOp-quotedOp - Apply review comments - Rename quoteOp to embedOp and quotedOp to extractOp ------------- Changes: - all: https://git.openjdk.org/babylon/pull/533/files - new: https://git.openjdk.org/babylon/pull/533/files/1afd4213..9a88ef80 Webrevs: - full: https://webrevs.openjdk.org/?repo=babylon&pr=533&range=01 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=533&range=00-01 Stats: 1434 lines in 48 files changed: 623 ins; 434 del; 377 mod Patch: https://git.openjdk.org/babylon/pull/533.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/533/head:pull/533 PR: https://git.openjdk.org/babylon/pull/533 From mabbay at openjdk.org Fri Aug 29 23:45:02 2025 From: mabbay at openjdk.org (Mourad Abbay) Date: Fri, 29 Aug 2025 23:45:02 GMT Subject: [code-reflection] RFR: Update ReflectMethods.BodyScanner.coerce to handle null targetType Message-ID: `ReflectMethods.BodyScanner.coerce` wasn't handling `null` targetType. For example, a `null` targetType may propagate to reach the method `coerce` when visiting case body of switch statement. ------------- Commit messages: - Update ReflectMethods.BodyScanner.coerce to handle null targetType Changes: https://git.openjdk.org/babylon/pull/536/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=536&range=00 Stats: 33 lines in 2 files changed: 29 ins; 2 del; 2 mod Patch: https://git.openjdk.org/babylon/pull/536.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/536/head:pull/536 PR: https://git.openjdk.org/babylon/pull/536 From gfrost at openjdk.org Sat Aug 30 09:51:51 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 30 Aug 2025 09:51:51 GMT Subject: git: openjdk/babylon: code-reflection: hat opwrapper removal round 2 Message-ID: <8787a431-3054-4490-8593-d41722a84e0e@openjdk.org> Changeset: a946101d Branch: code-reflection Author: Gary Frost Date: 2025-08-30 09:51:03 +0000 URL: https://git.openjdk.org/babylon/commit/a946101d2c01ee196a56409e0d7d4f50fd8151bc hat opwrapper removal round 2 ! hat/core/src/main/java/hat/codebuilders/HATCodeBuilderWithContext.java ! hat/core/src/main/java/hat/optools/ForOpWrapper.java ! hat/core/src/main/java/hat/optools/InvokeOpWrapper.java ! hat/core/src/main/java/hat/optools/LambdaOpWrapper.java ! hat/core/src/main/java/hat/optools/LogicalOpWrapper.java ! hat/core/src/main/java/hat/optools/OpWrapper.java ! hat/core/src/main/java/hat/optools/TernaryOpWrapper.java ! hat/core/src/main/java/hat/optools/WhileOpWrapper.java From gfrost at openjdk.org Sat Aug 30 09:54:08 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 30 Aug 2025 09:54:08 GMT Subject: [code-reflection] Integrated: hat opwrapper removal round 2 Message-ID: Second round of hat OpWrapper removal. ------------- Commit messages: - hat opwrapper removal round 2 Changes: https://git.openjdk.org/babylon/pull/537/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=537&range=00 Stats: 56 lines in 8 files changed: 6 ins; 29 del; 21 mod Patch: https://git.openjdk.org/babylon/pull/537.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/537/head:pull/537 PR: https://git.openjdk.org/babylon/pull/537 From gfrost at openjdk.org Sat Aug 30 09:54:08 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 30 Aug 2025 09:54:08 GMT Subject: [code-reflection] Integrated: hat opwrapper removal round 2 In-Reply-To: References: Message-ID: On Sat, 30 Aug 2025 09:49:07 GMT, Gary Frost wrote: > Second round of hat OpWrapper removal. This pull request has now been integrated. Changeset: a946101d Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/a946101d2c01ee196a56409e0d7d4f50fd8151bc Stats: 56 lines in 8 files changed: 6 ins; 29 del; 21 mod hat opwrapper removal round 2 ------------- PR: https://git.openjdk.org/babylon/pull/537 From gfrost at openjdk.org Sat Aug 30 14:36:31 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 30 Aug 2025 14:36:31 GMT Subject: git: openjdk/babylon: code-reflection: HAT remove OpWrapper round 3 Message-ID: <12420660-eb81-4096-a097-899f12ad6491@openjdk.org> Changeset: 66f2b514 Branch: code-reflection Author: Gary Frost Date: 2025-08-30 14:35:16 +0000 URL: https://git.openjdk.org/babylon/commit/66f2b514dacb5d680d0a527fc3194729a261fbff HAT remove OpWrapper round 3 ! 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/callgraph/ComputeCallGraph.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/codebuilders/HATCodeBuilderWithContext.java ! hat/core/src/main/java/hat/optools/FieldLoadOpWrapper.java ! hat/core/src/main/java/hat/optools/ForOpWrapper.java ! hat/core/src/main/java/hat/optools/FuncOpWrapper.java ! hat/core/src/main/java/hat/optools/InvokeOpWrapper.java ! hat/core/src/main/java/hat/optools/ModuleOpWrapper.java ! hat/core/src/main/java/hat/optools/OpWrapper.java ! hat/core/src/main/java/hat/optools/RootSet.java ! hat/core/src/main/java/hat/optools/WhileOpWrapper.java ! hat/examples/experiments/src/main/java/experiments/DependencyTree.java ! hat/tools/src/main/java/hat/tools/text/JavaHATCodeBuilder.java From gfrost at openjdk.org Sat Aug 30 14:38:56 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 30 Aug 2025 14:38:56 GMT Subject: [code-reflection] Integrated: HAT remove OpWrapper round 3 Message-ID: Round 3 removing OpWrapper. Moved common code into RootSet. Attempting to make all the OpWrapper method static so we can build a static class toolkit instead of wrapping each op. ------------- Commit messages: - HAT remove OpWrapper round 3 Changes: https://git.openjdk.org/babylon/pull/538/files Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=538&range=00 Stats: 189 lines in 16 files changed: 42 ins; 118 del; 29 mod Patch: https://git.openjdk.org/babylon/pull/538.diff Fetch: git fetch https://git.openjdk.org/babylon.git pull/538/head:pull/538 PR: https://git.openjdk.org/babylon/pull/538 From gfrost at openjdk.org Sat Aug 30 14:38:56 2025 From: gfrost at openjdk.org (Gary Frost) Date: Sat, 30 Aug 2025 14:38:56 GMT Subject: [code-reflection] Integrated: HAT remove OpWrapper round 3 In-Reply-To: References: Message-ID: On Sat, 30 Aug 2025 14:33:42 GMT, Gary Frost wrote: > Round 3 removing OpWrapper. > > Moved common code into RootSet. > > Attempting to make all the OpWrapper method static so we can build a static class toolkit instead of wrapping each op. This pull request has now been integrated. Changeset: 66f2b514 Author: Gary Frost URL: https://git.openjdk.org/babylon/commit/66f2b514dacb5d680d0a527fc3194729a261fbff Stats: 189 lines in 16 files changed: 42 ins; 118 del; 29 mod HAT remove OpWrapper round 3 ------------- PR: https://git.openjdk.org/babylon/pull/538