Skip to content

Create DPAS Analysis infrastructure#1558

Merged
etiotto merged 11 commits into
llvm-targetfrom
etiotto/dpas_analysis
Jul 9, 2024
Merged

Create DPAS Analysis infrastructure#1558
etiotto merged 11 commits into
llvm-targetfrom
etiotto/dpas_analysis

Conversation

@etiotto
Copy link
Copy Markdown
Contributor

@etiotto etiotto commented Jul 3, 2024

Create a DPASAnalysis class that analyzes a function (e.g. kernel) and determines whether tt.dot operations can be lowered to DPAS instructions on ATS/PVC target. In this PR we replace uses of supportDPAS with a public member function provided by the new class. A future PR will use the same infrastructure to change the subgroup size in the module if the analysis detects that a kernel contains tt.dot operations that would be optimizable (could be lowered to DPAS instructions) if the subgroup size was the one supported by the DPAS instruction for the target architecture (e.g. 16 on PVC).

Signed-off-by: Tiotto, Ettore <ettore.tiotto@intel.com>
@etiotto etiotto self-assigned this Jul 3, 2024
@etiotto etiotto linked an issue Jul 3, 2024 that may be closed by this pull request
Comment thread third_party/intel/lib/TritonIntelGPUTransforms/AccelerateMatmul.cpp Outdated
Signed-off-by: Tiotto, Ettore <ettore.tiotto@intel.com>
Comment thread third_party/intel/include/Analysis/DPAS.h Outdated

namespace mlir::triton::gpu::intel {

enum class DeviceArch {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note: moved to Utility.h

Comment thread third_party/intel/lib/TritonIntelGPUTransforms/AccelerateMatmul.cpp Outdated
Comment thread third_party/intel/lib/TritonIntelGPUTransforms/Utility.cpp
etiotto added 3 commits July 3, 2024 19:15
Signed-off-by: Tiotto, Ettore <ettore.tiotto@intel.com>
Signed-off-by: Tiotto, Ettore <ettore.tiotto@intel.com>
Signed-off-by: Tiotto, Ettore <ettore.tiotto@intel.com>
@etiotto etiotto requested review from a team, chengjunlu and whitneywhtsang July 3, 2024 19:18
Signed-off-by: Tiotto, Ettore <ettore.tiotto@intel.com>
@etiotto etiotto marked this pull request as ready for review July 4, 2024 15:25
@etiotto etiotto marked this pull request as draft July 8, 2024 21:02
Signed-off-by: Tiotto, Ettore <ettore.tiotto@intel.com>
@etiotto etiotto force-pushed the etiotto/dpas_analysis branch from 2d53b1f to 2e11c47 Compare July 8, 2024 21:18
@etiotto etiotto marked this pull request as ready for review July 8, 2024 21:21
Comment thread third_party/intel/include/Analysis/DPAS.h
Comment thread third_party/intel/lib/Analysis/DPAS.cpp
Comment thread third_party/intel/lib/Analysis/DPAS.cpp
Comment thread third_party/intel/lib/Analysis/DPAS.cpp
Comment thread third_party/intel/lib/Analysis/DPAS.cpp
Copy link
Copy Markdown

@victor-eds victor-eds left a comment

Choose a reason for hiding this comment

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

Looks to me we don't need a map at all. We can just:

  1. Check precondition (attribute+threads per warp)
  2. Walk and check each dot operation supports dpas:
    1. If an operation does not support it, set a member to False, exit
    2. If an operation potentially does not support it, set some member to MayBe

Comment thread third_party/intel/include/Analysis/DPAS.h Outdated
Comment thread third_party/intel/lib/Analysis/DPAS.cpp
Comment thread third_party/intel/lib/Analysis/DPAS.cpp Outdated
Comment thread third_party/intel/lib/Analysis/DPAS.cpp Outdated
Comment thread third_party/intel/lib/Analysis/DPAS.cpp
Comment thread third_party/intel/lib/Analysis/DPAS.cpp Outdated
Comment thread third_party/intel/lib/Analysis/DPAS.cpp
Comment thread third_party/intel/lib/Analysis/DPAS.cpp Outdated
Comment thread third_party/intel/lib/Analysis/DPAS.cpp Outdated
Comment thread third_party/intel/lib/Analysis/DPAS.cpp Outdated
@etiotto
Copy link
Copy Markdown
Contributor Author

etiotto commented Jul 9, 2024

Looks to me we don't need a map at all. We can just:

  1. Check precondition (attribute+threads per warp)

  2. Walk and check each dot operation supports dpas:

    1. If an operation does not support it, set a member to False, exit
    2. If an operation potentially does not support it, set some member to MayBe

We do not necessarily need the map but I want to keep it to have the flexibility to identify which tt.dot operations can be lowered to DPAS instructions. We might want to use that flexibility later.

Signed-off-by: Tiotto, Ettore <ettore.tiotto@intel.com>
@etiotto etiotto merged commit 82ad249 into llvm-target Jul 9, 2024
@etiotto etiotto deleted the etiotto/dpas_analysis branch July 9, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch subgroup size to 16 on tt.dot operations

4 participants