Skip to content

Commit

Permalink
[rocm] Add --iree-rocm-legacy-sync flag (default true). (#17786)
Browse files Browse the repository at this point in the history
We will eventually want to disable this entirely as we enable reusable
command buffers, graphs, and other optimizations.

Signed-off-by: Stella Laurenzo <[email protected]>
  • Loading branch information
stellaraccident authored Jul 2, 2024
1 parent 7bc9c59 commit 4cdc8e4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions compiler/plugins/target/ROCM/ROCMTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct ROCmOptions {
std::string bitcodeDirectory = getDefaultBitcodeDirectory();
int wavesPerEu = 0;
std::string enableROCMUkernels = "none";
bool legacySync = true;

void bindOptions(OptionsBinder &binder) {
using namespace llvm;
Expand All @@ -79,6 +80,9 @@ struct ROCmOptions {
cl::desc("Enables microkernels in the rocm compiler backend. May be "
"`default`, `none`, `all`, or a comma-separated list of "
"specific unprefixed microkernels to enable, e.g. `mmt4d`."));
binder.opt<bool>("iree-rocm-legacy-sync", legacySync, cl::cat(category),
cl::desc("Enables 'legacy-sync' mode, which is required "
"for inline execution."));
}

LogicalResult verify(mlir::Builder &builder) const {
Expand Down Expand Up @@ -176,10 +180,14 @@ class ROCMTargetDevice final : public TargetDevice {
getDefaultDeviceTarget(MLIRContext *context,
const TargetRegistry &targetRegistry) const override {
Builder b(context);
// Indicates that the runtime HAL driver operates only in the legacy
// synchronous mode.
DictionaryAttr configAttr = b.getDictionaryAttr(
NamedAttribute(b.getStringAttr("legacy_sync"), b.getUnitAttr()));
SmallVector<NamedAttribute> configAttrItems;
if (options.legacySync) {
// Indicates that the runtime HAL driver operates only in the legacy
// synchronous mode.
configAttrItems.emplace_back(b.getStringAttr("legacy_sync"),
b.getUnitAttr());
}
DictionaryAttr configAttr = b.getDictionaryAttr(configAttrItems);

// If we had multiple target environments we would generate one target attr
// per environment, with each setting its own environment attribute.
Expand Down

0 comments on commit 4cdc8e4

Please sign in to comment.