Skip to content

Commit

Permalink
Remove legacy sync path (#19714)
Browse files Browse the repository at this point in the history
This removes all the needless blocking operations that were occurring on
hip. Removal should boost speed and allow multi device parallelism.
  • Loading branch information
rsuderman authored Jan 16, 2025
1 parent f6f6388 commit 3e8c81c
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 469 deletions.
12 changes: 1 addition & 11 deletions compiler/plugins/target/ROCM/ROCMTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,12 @@ namespace mlir::iree_compiler::IREE::HAL {
namespace {

// TODO(#18792): rename flags back to iree-rocm- as they are not HIP-specific.
// Only iree-hip-legacy-sync applies uniquely to HIP.
struct ROCMOptions {
std::string target = "";
std::string targetFeatures = "";
std::string bitcodeDirectory = getDefaultBitcodeDirectory();
int wavesPerEu = 0;
std::string enableROCMUkernels = "none";
bool legacySync = true;
bool slpVectorization = true;
bool globalISel = false;

Expand Down Expand Up @@ -107,9 +105,7 @@ struct ROCMOptions {
cl::desc("Enables microkernels in the HIP 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-hip-legacy-sync", legacySync, cl::cat(category),
cl::desc("Enables 'legacy-sync' mode, which is required "
"for inline execution."));

binder.list<std::string>(
"iree-hip-pass-plugin-path", passPlugins,
cl::desc("LLVM pass plugins are out of tree libraries that implement "
Expand Down Expand Up @@ -876,12 +872,6 @@ class HIPTargetDevice final : public TargetDevice {
Builder b(context);

SmallVector<NamedAttribute> deviceConfigAttrs;
if (options.legacySync) {
// Indicates that the runtime HAL driver operates only in the legacy
// synchronous mode.
deviceConfigAttrs.emplace_back(b.getStringAttr("legacy_sync"),
b.getUnitAttr());
}
auto deviceConfigAttr = b.getDictionaryAttr(deviceConfigAttrs);

SmallVector<NamedAttribute> executableConfigAttrs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ iree_compiler_cc_library(
"DumpExecutableBenchmarks.cpp",
"DumpExecutableSources.cpp",
"ElideRedundantCommands.cpp",
"FixupLegacySync.cpp",
"HoistExecutableObjects.cpp",
"InitializeDevices.cpp",
"InlineMemoizeRegions.cpp",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ iree_cc_library(
"DumpExecutableBenchmarks.cpp"
"DumpExecutableSources.cpp"
"ElideRedundantCommands.cpp"
"FixupLegacySync.cpp"
"HoistExecutableObjects.cpp"
"InitializeDevices.cpp"
"InlineMemoizeRegions.cpp"
Expand Down
210 changes: 0 additions & 210 deletions compiler/src/iree/compiler/Dialect/HAL/Transforms/FixupLegacySync.cpp

This file was deleted.

4 changes: 0 additions & 4 deletions compiler/src/iree/compiler/Dialect/HAL/Transforms/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,6 @@ void buildHALTransformPassPipeline(OpPassManager &passManager,
passManager.addPass(IREE::HAL::createOutlineMemoizeRegionsPass());
}

// If any devices require the legacy synchronous execution behavior then
// make all async operations blocking.
passManager.addPass(IREE::HAL::createFixupLegacySyncPass());

// Prune unused executables and their contents.
passManager.addPass(IREE::HAL::createPruneExecutablesPass());

Expand Down
18 changes: 0 additions & 18 deletions compiler/src/iree/compiler/Dialect/HAL/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -187,24 +187,6 @@ def VerifyDevicesPass :
];
}

def FixupLegacySyncPass :
Pass<"iree-hal-fixup-legacy-sync", "mlir::ModuleOp"> {
let summary = "Applies fixups to the program for when using legacy HAL devices.";
let description = [{
Applies fixups to the program for when using legacy HAL devices that only
support synchronous execution. Once all devices support async this will be
removed.

NOTE: this pass only exists for backwards compatibility with legacy HAL
drivers. It will be removed once all have migrated to the modern async APIs.
}];
let dependentDialects = [
"mlir::arith::ArithDialect",
"IREE::HAL::HALDialect",
"IREE::Util::UtilDialect",
];
}

def InlineMemoizeRegionsPass :
Pass<"iree-hal-inline-memoize-regions", ""> {
let summary = "Inlines `hal.device.memoize` regions into their parent region.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ iree_lit_test_suite(
"dump_executable_benchmarks.mlir",
"dump_executable_sources.mlir",
"elide_redundant_commands.mlir",
"fixup_legacy_sync.mlir",
"hoist_executable_objects.mlir",
"initialize_devices.mlir",
"inline_memoize_regions.mlir",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ iree_lit_test_suite(
"dump_executable_benchmarks.mlir"
"dump_executable_sources.mlir"
"elide_redundant_commands.mlir"
"fixup_legacy_sync.mlir"
"hoist_executable_objects.mlir"
"initialize_devices.mlir"
"inline_memoize_regions.mlir"
Expand Down
Loading

0 comments on commit 3e8c81c

Please sign in to comment.