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

[XPU][OptEW] Define -intel-triton-optimize-elementwise-parallelism pass #2631

Merged
merged 6 commits into from
Nov 12, 2024

Conversation

victor-eds
Copy link
Contributor

Define pass improving elementwise parallelism by avoiding layout conversions leading to data duplication between threads.

See pass documentation for more information.

…pass

Define pass improving elementwise parallelism by avoiding layout conversions
leading to data duplication between threads.

See pass documentation for more information.

Signed-off-by: victor-eds <victor.perez@codeplay.com>
@victor-eds
Copy link
Contributor Author

First step for #2562.

// CHECK: %[[VAL_4:.*]] = tt.splat %[[VAL_2]] : f32 -> tensor<128xf32, #triton_gpu.slice<{dim = 1, parent = #[[$ATTR_4]]}>>
%2 = tt.splat %arg2 : f32 -> tensor<128xf32, #triton_gpu.slice<{dim = 1, parent = #blocked1}>>
%3 = arith.addf %0, %1 : tensor<128xf32, #triton_gpu.slice<{dim = 1, parent = #blocked1}>>
// CHECK: %[[VAL_5:.*]] = arith.addf %[[VAL_4]], %[[VAL_3]] : tensor<128xf32, #triton_gpu.slice<{dim = 1, parent = #[[$ATTR_4]]}>>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The layout conversion that would result from %[[VAL_3]] conversion is erased by the pass as we can see

Comment on lines 406 to 407
let dependentDialects = ["mlir::triton::TritonDialect",
"mlir::triton::gpu::TritonGPUDialect"];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we find an elementwise operation from dialect X, that means the dialect has been loaded already, so no need to have it as a dependent dialect in order to create this. We want to include these two for future proofing, tho.

@vlad-penkin vlad-penkin linked an issue Nov 6, 2024 that may be closed by this pull request
@victor-eds
Copy link
Contributor Author

@intel/triton-codeplay-reviewers @etiotto @whitneywhtsang @chengjunlu Can I get reviews here? I already have a PR hanging on this one and will add more on Monday, so I'd like to begin getting this work merged.

@victor-eds
Copy link
Contributor Author

I may change the approach to this next week. Delay reviews for now.

@victor-eds victor-eds marked this pull request as draft November 8, 2024 17:09
@victor-eds victor-eds marked this pull request as ready for review November 11, 2024 09:45
@victor-eds victor-eds marked this pull request as draft November 11, 2024 09:45
@etiotto etiotto merged commit 0d9c0d3 into intel:main Nov 12, 2024
4 checks passed
@victor-eds victor-eds deleted the elementwise-locality branch November 12, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement -tritonintelgpu-optimize-elementwise-locality
3 participants