This is an archive of the discontinued LLVM Phabricator instance.

Add gpu::LaunchOp::addKernelArgument.
AbandonedPublic

Authored by herhut on Jan 27 2020, 5:34 AM.

Details

Summary

Code motion into a gpu::LaunchOp region requires operands of moved
instructions to be threaded through operands of the gpu.launch to
ensure that the gpu.launch remaines closed from above.

To enable this, gpu.launch operations are now created with extensible
operand storage. The overhead is expected to be low given that
gpu.launch is a relatively rare operation.

Diff Detail

Event Timeline

herhut created this revision.Jan 27 2020, 5:34 AM

Unit tests: fail. 62155 tests passed, 5 failed and 811 were skipped.

failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

ftynse accepted this revision.Jan 27 2020, 6:01 AM
ftynse added inline comments.
mlir/include/mlir/Dialect/GPU/GPUOps.td
488

This says "gpu.launch" but the line above says "gpu.func". Let's use one everywhere and say the other is equivalent.

This revision is now accepted and ready to land.Jan 27 2020, 6:01 AM
herhut marked an inline comment as done.Jan 27 2020, 11:16 AM
herhut added inline comments.
mlir/include/mlir/Dialect/GPU/GPUOps.td
488

But they are not. When used inside of a launch, it cannot have operands. I could maybe state that gpu.launch is considered equivalent to a void function? I found it surprising that launch now has a return (as opposed to the terminator). That moves it closer to a function where it should feel more like a loop. WDYT about adding the terminator op back or is that too many operations?

ftynse added inline comments.Jan 27 2020, 1:36 PM
mlir/include/mlir/Dialect/GPU/GPUOps.td
488

Then it's even more confusing than I thought. I'm fine with having a separate terminator for launch.

rriddle added inline comments.Jan 27 2020, 1:42 PM
mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
285

nit: You can also use append to add arguments:

emitError().append(..., ..., ...).attachNote(...).append(..., ..., ...);

Code motion into a gpu::LaunchOp region requires operands of moved instructions to be threaded through operands of the gpu.launch to ensure that the gpu.launch remaines closed from above.

Can we revisit lifting this requirement? This was something that was raised from the beginning of the development of this op.

Code motion into a gpu::LaunchOp region requires operands of moved instructions to be threaded through operands of the gpu.launch to ensure that the gpu.launch remaines closed from above.

Can we revisit lifting this requirement? This was something that was raised from the beginning of the development of this op.

Should we just lift the requirement or completely forego the concept of passing arguments into the launch? Just lifting the requirement would be less of a breaking change but there is no good use of having the operands.

herhut updated this revision to Diff 240821.Jan 28 2020, 3:13 AM

Split out gpu dialect cleanup parts.

herhut marked 2 inline comments as done.Jan 28 2020, 3:14 AM
herhut added inline comments.
mlir/include/mlir/Dialect/GPU/GPUOps.td
488

I will add it back in a new diff.

mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
285

Thanks! I will do this in a new diff.

Unit tests: fail. 62155 tests passed, 5 failed and 811 were skipped.

failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

Code motion into a gpu::LaunchOp region requires operands of moved instructions to be threaded through operands of the gpu.launch to ensure that the gpu.launch remaines closed from above.

Can we revisit lifting this requirement? This was something that was raised from the beginning of the development of this op.

Should we just lift the requirement or completely forego the concept of passing arguments into the launch? Just lifting the requirement would be less of a breaking change but there is no good use of having the operands.

Right: I'm not sure what is the use for having the operands at all?

herhut abandoned this revision.Jan 31 2020, 1:38 AM

I went for lifting the requirement that gpu.launch needs to be closed from above. So we no longer have any arguments.

See https://reviews.llvm.org/D73769