Skip to content

Move hal.executable.entry_point ops into hal.executable.target. - #2893

Merged
ScottTodd merged 1 commit into
iree-org:mainfrom
ScottTodd:hal-transforms
Aug 19, 2020
Merged

ScottTodd merged 1 commit into
iree-org:mainfrom
ScottTodd:hal-transforms

Conversation

@ScottTodd

Copy link
Copy Markdown
Member

The HAL transformation pass pipeline "materializes interfaces" then "translates executables" for each configured target (source). As part of its executable translation, the VulkanSPIRV target "splits" dispatch functions using SplitDispatchFunctionPass, creating a schedule of spv.EntryPoint ops to dispatch in sequence when recordDispatch() is called (source).

For #1890, we want to change dispatch ops from using loose ordinals for entry points:

hal.command_buffer.dispatch %arg0, %arg1, entry_point = 0, workgroup_xyz = ...

to using nested references:

hal.command_buffer.dispatch %arg0, %arg1, entry_point = @MyExecutable::EntryPoint, workgroup_xyz = ...

To use references in that format, the VulkanSPIRV target should create new hal.executable.entry_point ops which can be referenced whenever it splits dispatch functions. However, entry points are currently placed on hal.executable ops, which can contain multiple hal.executable.target ops (e.g. several for "vulkan" and one for "vmla"). Thus, this PR moves entry points down into hal.executable.target ops so that each target can have more control over how it sets up its entry points.


I explored a few different ways to structure the passes involved as part of this work, each with some tradeoffs. Happy to make changes now that I have a better handle on how this all fits together.

@ScottTodd ScottTodd added compiler/dialects Relating to the IREE compiler dialects (flow, hal, vm) hal/vulkan Runtime Vulkan GPU HAL backend codegen/spirv SPIR-V code generation compiler backend labels Aug 14, 2020
@google-cla google-cla Bot added the cla: yes label Aug 14, 2020
@ScottTodd
ScottTodd marked this pull request as ready for review August 14, 2020 22:36
@ScottTodd
ScottTodd requested a review from benvanik August 14, 2020 22:36
auto executableOp = cast<ExecutableOp>(targetOp.getParentOp());
auto entryPointOps =
executableOp.getBlock().getOps<ExecutableEntryPointOp>();
auto entryPointOps = targetOp.getBlock().getOps<ExecutableEntryPointOp>();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is much nicer! walking up the IR tree has a smell :)

@ScottTodd
ScottTodd merged commit d432945 into iree-org:main Aug 19, 2020
@ScottTodd
ScottTodd deleted the hal-transforms branch August 19, 2020 19:23
@ScottTodd ScottTodd mentioned this pull request Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codegen/spirv SPIR-V code generation compiler backend compiler/dialects Relating to the IREE compiler dialects (flow, hal, vm) hal/vulkan Runtime Vulkan GPU HAL backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants