[code-reflection] RFR: PTX backend implementation for HAT
Paul Sandoz
psandoz at openjdk.org
Mon Jul 22 22:16:48 UTC 2024
On Fri, 19 Jul 2024 19:36:16 GMT, Ruby Chen <duke at openjdk.org> wrote:
> Implemented a PTX backend for HAT kernel execution; PTX will run on machines with supporting Nvidia GPUs. Currently works for Squares and Mandel kernel examples.
>
> Also starting to implement a BlackScholes kernel for HAT.
This is a good first start. I'll let Gary review further.
Some future changes to consider:
- It may be easier to further transform into pure SSA, then you don't have to deal with var-based operations. You can map values (block parameters) to runtime arguments, although what I think you really want here is a mapping of some block parameters to their schema (see next point).
- If we want a more fleshed out transformation to pointers i think it requires transforming the values whose types are Java interfaces to values whose types are pointers that refer to the schema. Then invocations on the interfaces are transformed into pointer member access operations (based on relative offset to the component, a special case of pointer addition where the pointer type can change), and load/store operations on values of pointers that point to scalars. That way it should compose when accessing nested structures, and there is a clearer mapping between the pointer operations and the PTX operations.
hat/backends/ptx/src/main/java/hat/backend/PTXBackend.java line 93:
> 91: String out = "";
> 92: Optional<CoreOp.FuncOp> o = Optional.ofNullable(kernelCallGraph.entrypoint.funcOpWrapper().op());
> 93: FuncOpWrapper f = new FuncOpWrapper(o.orElseThrow());
You don't need to wrap in an optional and then unwrap, just use the value directly. Same for other places.
-------------
PR Review: https://git.openjdk.org/babylon/pull/188#pullrequestreview-2192566907
PR Review Comment: https://git.openjdk.org/babylon/pull/188#discussion_r1687150125
More information about the babylon-dev
mailing list