-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add amd-aie-direct
HAL target (3/n)
#420
Add amd-aie-direct
HAL target (3/n)
#420
Conversation
amd-aie-direct
HAL target (2/n)amd-aie-direct
HAL target (3/n)
7d93c21
to
5a46312
Compare
8e65276
to
9b3416a
Compare
dfcbfa3
to
a295d90
Compare
a295d90
to
41c9b5e
Compare
77bead4
to
775351e
Compare
41c9b5e
to
37599a1
Compare
b375fab
to
dfea3a6
Compare
7fa1376
to
d4dea46
Compare
329e0e7
to
2eda0d0
Compare
d4dea46
to
7c45ac3
Compare
bf23c05
to
3578f9e
Compare
@newling @nirvedhmeshram this is now ready for your keen eyes! |
3578f9e
to
ac58e66
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good, just some minor comments.
compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.h
Outdated
Show resolved
Hide resolved
compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/Passes.cpp
Outdated
Show resolved
Hide resolved
compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/Passes.h
Outdated
Show resolved
Hide resolved
compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/AIETargetDirect.cpp
Outdated
Show resolved
Hide resolved
compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/AIETargetDirect.cpp
Outdated
Show resolved
Hide resolved
compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/AIETargetDirect.cpp
Outdated
Show resolved
Hide resolved
compiler/plugins/target/AMD-AIE/iree-amd-aie/PluginRegistration.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, after fixing the test/CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments but they can all be ignored as I think it'll easier to make changes once everything is landed, and temporary code is removed.
std::string XCLBinKernelID; | ||
std::string XCLBinInstanceName; | ||
bool UseChess = false; | ||
bool DisableThreading = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These flags -- do we still need them?
Specifically 'DisableThreading' here is just something we had to throw over the wall because the mlir-aie passes are run on a completely new process (i.e. a new MLIR Context). If the passes are now being run in the same context.
Not a request for change, just some information for you.
|
||
namespace mlir::iree_compiler::AMDAIE { | ||
|
||
// static llvm::cl::opt<std::string> clEnableAMDAIEUkernels( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flag is in AIETarget
and so this target should also support it but I can't register the cl::opt
(because they're static globals). So I left it here as a reminder to myself.
compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/AIETargetDirect.cpp
Outdated
Show resolved
Hide resolved
compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/AIETargetDirect.cpp
Outdated
Show resolved
Hide resolved
52d7a11
to
d4a34e1
Compare
d4a34e1
to
3f3cd29
Compare
Since #420 added a internal utility to go from AIE to XCLBIN it makes sense for all flows to use that. This utility doesn't add any AIE lowering passes so the `TranslationPassPipeline`s are responsible for that. Hence the passes needed for the IR lowered through the AIR flow to be further lowered to AIE are added in its lowering pipeline. There were some minor additions needed to the utility to get it working e2e for the AIE flow. We no longer need to have a separate `aie2xclbin-disable-threading` as we are passing the existing context and the `mlir-disable-threading` flag gets automatically propagated in this case. And it actually gives an error to try changing it if the passed context is multi-threaded. With this PR the AIE lowering is becoming a part of the IREE `TranslationPassPipeline` so the pack-peel lit test that was just passing the air-to-aie conversion had to be watered down to reflect what can actually be lowered to AIE. Unfortunately, we still also need the mlir-aie wheel as the internal utility is still expecting a mlir-aie install for me_basic.o library [here](https://github.com/nod-ai/iree-amd-aie/blob/main/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp#L302-L304)
This PR is part of a stack of PRs that refactor the dependency on MLIR-AIE. See #430 for more information.
This PR adds a new target
amd-aiet-direct
, directly references AIEVec passes (for eventual lowering of core code to chess LLVM IR) and also (simultaneously) vendorsXCLBinGen.cpp
frommlir-aie
(second part used to be broken out in #422 but on @newling's suggestion I squashed). Note,XCLBinGen
andAIETargetDirect
are basically carbon copies of what currently exists exceptAIETargetDirect
doesn't shell out and callsaie2xclbin
directly. Note also thatXCLBinGen
will undergo further revision up to for the chess backend (but that'll have to wait until I get home).To test, I added some lines to
print_ir_aie2xclbin.sh
. I'm happy to bike shed this but probably not too hard.