Skip to content
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

Enable attention by default on mi300 #3463

Merged
merged 6 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/targets/gpu/fuse_mlir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,14 @@ static bool specific_op(std::string_view option, bool fallback = false)
return contains(options, option);
}

bool mlir_attention_enabled()
bool mlir_attention_enabled(context* ctx)
{
#ifdef MIGRAPHX_MLIR
if(not mlir_enabled())
return false;
// Enable attention by default for mi300
if(ctx != nullptr and starts_with(ctx->get_current_device().get_gfx_name(), "gfx94"))
return true;
return specific_op<requested>("attention");
#else
return false;
Expand Down Expand Up @@ -996,7 +999,7 @@ void fuse_mlir::apply(module_pass_manager& mpm) const
};

// Attention offloads; default disabled
if(mlir_attention_enabled() or enable_extra)
if(mlir_attention_enabled(ctx) or enable_extra)
{
match::find_matches(mpm, find_mlir_attention_fused_ops{mlir_mode::all});
mpm.run_pass(dead_code_elimination{});
Expand Down
1 change: 0 additions & 1 deletion src/targets/gpu/include/migraphx/gpu/fuse_mlir.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ struct module_pass_manager;
namespace gpu {

MIGRAPHX_GPU_EXPORT bool mlir_enabled();
MIGRAPHX_GPU_EXPORT bool mlir_attention_enabled();

struct MIGRAPHX_GPU_EXPORT fuse_mlir
{
Expand Down
Loading