repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
intel-xpu-backend-for-triton
github_2023
cpp
939
intel
Dewei-Wang-sh
@@ -0,0 +1,240 @@ +//===- PipelineManager.h - TritonIntelGPU pipeline manager ------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--...
same concern here, if we move this to "tritongputollvm.cpp", we can avoid copy the above func conversion part, thus can ease future change.
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -11,6 +11,18 @@ include "mlir/Pass/PassBase.td" +def TritonIntelGPURemoveLayoutConversions : Pass<"tritonintelgpu-remove-layout-conversions", "mlir::ModuleOp"> { + let summary = "remove superfluous layout conversions"; + + let description = [{ + }];
This needs a proper description with examples.
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -11,6 +11,18 @@ include "mlir/Pass/PassBase.td" +def TritonIntelGPURemoveLayoutConversions : Pass<"tritonintelgpu-remove-layout-conversions", "mlir::ModuleOp"> { + let summary = "remove superfluous layout conversions"; + + let description = [{ + }]; + + let constructor = "mlir::triton::gpu::intel::createTri...
Add dependent dialects.
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
whitneywhtsang
@@ -13,21 +13,23 @@ #include "mlir/Transforms/Passes.h" #include "mlir/Transforms/RegionUtils.h" #include "triton/Analysis/Utility.h" -#include "triton/Dialect/TritonGPU/Transforms/TritonGPUConversion.h" #include "triton/Dialect/TritonGPU/Transforms/Utility.h" #include "triton/Dialect/TritonIntelGPU/IR/Dialect.h" ...
why do you want to following functions in intel namespace?
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -84,6 +89,133 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +// -------------------------------------------------------------------------- // + +static std::optional<Attribute> inferSrcEncoding(triton::MakeTensorPtrOp op, + At...
I would remove these 2 functions as they just return the encoding.
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -84,6 +89,133 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +// -------------------------------------------------------------------------- // + +static std::optional<Attribute> inferSrcEncoding(triton::MakeTensorPtrOp op, + At...
```suggestion return encoding; ```
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -84,6 +89,133 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +// -------------------------------------------------------------------------- // + +static std::optional<Attribute> inferSrcEncoding(triton::MakeTensorPtrOp op, + At...
```suggestion return encoding; ```
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -84,6 +89,133 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +// -------------------------------------------------------------------------- // + +static std::optional<Attribute> inferSrcEncoding(triton::MakeTensorPtrOp op, + At...
[nit]: remove empty line
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -84,6 +89,133 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +// -------------------------------------------------------------------------- // + +static std::optional<Attribute> inferSrcEncoding(triton::MakeTensorPtrOp op, + At...
[nit]: Case 1a, Case 1b --> Case 1, Case 2 (as there isn't a case 2 in what you have now).
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -84,6 +89,133 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +// -------------------------------------------------------------------------- // + +static std::optional<Attribute> inferSrcEncoding(triton::MakeTensorPtrOp op, + At...
return (ptrType.getNumElements() < numWarps * threadsPerWarp);
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -84,6 +89,133 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +// -------------------------------------------------------------------------- // + +static std::optional<Attribute> inferSrcEncoding(triton::MakeTensorPtrOp op, + At...
```suggestion if (auto convertOp = dyn_cast<triton::gpu::ConvertLayoutOp>(op)) return isMmaToMmaShortcut(convertOp.getSrc().getType(), convertOp.getType()); return false; ```
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -84,6 +89,133 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +// -------------------------------------------------------------------------- // + +static std::optional<Attribute> inferSrcEncoding(triton::MakeTensorPtrOp op, + At...
```suggestion if (!isTensorOrTensorPointerType(currentType)) ```
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -84,6 +89,133 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +// -------------------------------------------------------------------------- // + +static std::optional<Attribute> inferSrcEncoding(triton::MakeTensorPtrOp op, + At...
```suggestion if (result == currentValue || !isTensorOrTensorPointerType(resultType)) ```
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -0,0 +1,2296 @@ +// RUN: triton-opt %s -split-input-file -tritonintelgpu-remove-layout-conversions 2>&1 | FileCheck %s
This looks like a copy of test/TritonGPU/combine.mlir. Please confirm.
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -105,6 +105,8 @@ def TritonIntelGPURemoveLayoutConversions : Pass<"tritonintelgpu-remove-layout-c let summary = "remove superfluous layout conversions"; let description = [{ + The Intel GPU HW has efficient memory accessing HW. + Prefer to backward combine the dot operand layout to the tt.load with pointer...
Can you please add an Example here ?
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -0,0 +1,69 @@ +// RUN: triton-opt %s -split-input-file -tritonintelgpu-remove-layout-conversions 2>&1 | FileCheck %s + +// CHECK: #[[$ATTR_0:.+]] = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [1, 16], warpsPerCTA = [1, 4], order = [1, 0]}> +// CHECK: #[[$ATTR_1:.+]] = #triton_intel_gpu.dpas<{repeat...
Change #mma to #dpas because is confusing to us the NVIDIA terminology in a test for Intel GPU.
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -0,0 +1,69 @@ +// RUN: triton-opt %s -split-input-file -tritonintelgpu-remove-layout-conversions 2>&1 | FileCheck %s + +// CHECK: #[[$ATTR_0:.+]] = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [1, 16], warpsPerCTA = [1, 4], order = [1, 0]}> +// CHECK: #[[$ATTR_1:.+]] = #triton_intel_gpu.dpas<{repeat...
Change `#{{.*}}` to triton_gpu.dot_op
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -0,0 +1,69 @@ +// RUN: triton-opt %s -split-input-file -tritonintelgpu-remove-layout-conversions 2>&1 | FileCheck %s + +// CHECK: #[[$ATTR_0:.+]] = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [1, 16], warpsPerCTA = [1, 4], order = [1, 0]}>
Lets use descriptive names for the layout "variable" like `#[[BLOCKED:.+]]` blocked and #[[DPAS:.+]]`
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -105,6 +105,37 @@ def TritonIntelGPURemoveLayoutConversions : Pass<"tritonintelgpu-remove-layout-c let summary = "remove superfluous layout conversions"; let description = [{ + This is a customized remove layout conversion for Intel GPU arch. + There are different preference in optimization when removi...
#mma -> #dpas
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -105,6 +105,37 @@ def TritonIntelGPURemoveLayoutConversions : Pass<"tritonintelgpu-remove-layout-c let summary = "remove superfluous layout conversions"; let description = [{ + This is a customized remove layout conversion for Intel GPU arch. + There are different preference in optimization when removi...
### ```suggestion Different GPUs characteristics make it profitable for Intel HW to load the operands of a `tt.dot` operation into registers. Therefore given the following example: ```
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -105,6 +105,37 @@ def TritonIntelGPURemoveLayoutConversions : Pass<"tritonintelgpu-remove-layout-c let summary = "remove superfluous layout conversions"; let description = [{ + This is a customized remove layout conversion for Intel GPU arch. + There are different preference in optimization when removi...
which is different to the common TTGIR remove layout conversions. -> (which deviates from the common TTGIR remove layout conversion):
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -105,6 +105,37 @@ def TritonIntelGPURemoveLayoutConversions : Pass<"tritonintelgpu-remove-layout-c let summary = "remove superfluous layout conversions"; let description = [{ + This is a customized remove layout conversion for Intel GPU arch. + There are different preference in optimization when removi...
#mma -> #dpas
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -105,6 +105,37 @@ def TritonIntelGPURemoveLayoutConversions : Pass<"tritonintelgpu-remove-layout-c let summary = "remove superfluous layout conversions"; let description = [{ + This is a customized remove layout conversion for Intel GPU arch. + There are different preference in optimization when removi...
On NVidia GPUs it is profitable to load the operands of a `tt.dot` operation into shared local memory (therefore the layout conversion operations are necessary). On Intel GPUs loading into SLM is not profitable because it would require synchronization operations that are expensive. Therefore it is better to load the op...
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -0,0 +1,68 @@ +// RUN: triton-opt %s -split-input-file -tritonintelgpu-remove-layout-conversions 2>&1 | FileCheck %s + +// CHECK: #[[$BLOCK:.+]] = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [1, 16], warpsPerCTA = [1, 4], order = [1, 0]}> +// CHECK: #[[$DPAS:.+]] = #triton_intel_gpu.dpas<{repeatCou...
Let's be consistent and avoid using $DPAS ($BLOCK). Use DPAS/BLOCK instead.
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -0,0 +1,68 @@ +// RUN: triton-opt %s -split-input-file -tritonintelgpu-remove-layout-conversions 2>&1 | FileCheck %s + +// CHECK: #[[$BLOCK:.+]] = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [1, 16], warpsPerCTA = [1, 4], order = [1, 0]}>
Add: // COM: Checks that the loads for the operands of a `tt.dot` operation are placed into registers (have `dot` layout) rather than shared local memory (via a ` triton_gpu.convert_layout ` operation).
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -0,0 +1,71 @@ +// RUN: triton-opt %s -split-input-file -tritonintelgpu-remove-layout-conversions 2>&1 | FileCheck %s + +// COM: Checks that the loads for the operands of a tt.dot operation are placed +// COM: into registers (have dot layout) rather than shared local memory (via a +// COM: triton_gpu.convert_layout o...
More cleanup: remove divisibility and nolinline ...
intel-xpu-backend-for-triton
github_2023
others
872
intel
etiotto
@@ -0,0 +1,71 @@ +// RUN: triton-opt %s -split-input-file -tritonintelgpu-remove-layout-conversions 2>&1 | FileCheck %s + +// COM: Checks that the loads for the operands of a tt.dot operation are placed +// COM: into registers (have dot layout) rather than shared local memory (via a +// COM: triton_gpu.convert_layout o...
CHECK-NOT triton_gpu.convert_layout ?
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -85,6 +89,116 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +std::optional<Attribute> inferSrcEncoding(Operation *op, Attribute encoding) { + if (auto makeTensorPtrOp = dyn_cast<triton::MakeTensorPtrOp>(op)) + return encoding; + if (auto advanceOp = dyn_cast<triton::Ad...
Add a assert to check that `opt` is one of `tt.LoadOp` or `tt.StoreOp`
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -85,6 +89,116 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +std::optional<Attribute> inferSrcEncoding(Operation *op, Attribute encoding) { + if (auto makeTensorPtrOp = dyn_cast<triton::MakeTensorPtrOp>(op)) + return encoding; + if (auto advanceOp = dyn_cast<triton::Ad...
To improve readability: ``` OpOperand *base = op->getOperand(0); if (isSingleValue(base)) ...
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -85,6 +89,116 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +std::optional<Attribute> inferSrcEncoding(Operation *op, Attribute encoding) { + if (auto makeTensorPtrOp = dyn_cast<triton::MakeTensorPtrOp>(op)) + return encoding; + if (auto advanceOp = dyn_cast<triton::Ad...
Looks suspicious because the base (operand(0)) of a load/store operation can be a ptr to a tensor. So the cast doesn't look safe.
intel-xpu-backend-for-triton
github_2023
cpp
872
intel
etiotto
@@ -85,6 +89,124 @@ DPASEngineType getDPASType(DotOp op) { return DPASEngineType::NOT_APPLICABLE; } +std::optional<Attribute> inferSrcEncoding(Operation *op, Attribute encoding) { + if (auto makeTensorPtrOp = dyn_cast<triton::MakeTensorPtrOp>(op)) + return encoding; + if (auto advanceOp = dyn_cast<triton::Ad...
Is odd to have a function that checks for NVidia MMA->MMA layout conversion. Do you want to adapt this code to check for DPAS->DPAS conversion ?
intel-xpu-backend-for-triton
github_2023
others
636
intel
aregm
@@ -0,0 +1,256 @@ +##################################### +"Hello, World!" and Programming model +##################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function or routine that executed on target GPU device. It is some function that can be effectively e...
##################################### "Hello, World!" and the Programming Model ##################################### ******** Glossary ******** * **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. * **SPMD** stands for Single P...
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion * **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to run on a specific GPU target. Each Triton kernel requires the ``@triton.jit`` annotation. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion * **Single Program Multiple Data** (SPMD) is a programming paradigm where the same kernel (i.e., program) is replicated across multiple hardware instances. The same kernel is applied to different subsets of input data generated by dividing by the number of execution threads. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion * **Thread** represents the smallest execution unit on a GPU. Threads within the same block can communicate and synchronize with each other. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion * **Block** (or **Thread Block** or **WorkGroup**) is a two- or three-dimensional group of threads executing the same code simultaneously on a GPU. Threads within the same block can share data through shared memory and synchronize their execution. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion * **Grid** is a three-dimensional collection of thread blocks. It defines the overall structure of parallel execution on a GPU. Each grid dimension (X, Y, and Z) represents the number of thread blocks along that axis. Threads in different blocks within the same grid communicate only through global memory...
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion "Hello, World!" in Triton ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Triton programs are single-threaded, which makes them easier to write, maintain, optimize, and debug. However, this also requires the development of automatic parallelization mechanisms. These mechanisms must generate efficient multi-threaded GPU code based on high-level specifications of blocked algorit...
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Additionally, Triton enables the distribution of kernels in a 3D logical thread space. This distribution method is commonly used to map logical threads to data, enhancing data locality. Moreover, logical threads are executed with multiple hardware threads. We will start with the simplest case with one lo...
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion The simplest case to observe in Triton is a vector sum of two vectors. (We will use the default data type as fp32.) ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Let's begin with a basic implementation. All Triton kernels require the ``@triton.jit`` annotation and accept a limited range of argument types. The supported argument types are: ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion 1. Pointer to data (Object with ``data_ptr()`` and ``dtype()`` - commonly, we will use ``torch.tensor`` for this purpose) ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion # There are multiple 'programs' processing different data. Here, we identify which program program we are in: ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion This kernel loads all available data of the whole vector with the help of ``tl.arange``. Like many other triton.language operations, ``tl.arange`` operates with ``tl.constexpr`` only. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion So what is ``tl.constexpr``? It is a kernel argument specifier that indicates to the kernel that its value can be calculated during compilation. In simple words, it should be a static constant for the kernel. If its value changes, the kernel requires recompilation to produce a different executable binary...
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion A raw call like ``tl.load(x_ptr)`` will only load a single value. So where does ``tl.load`` load the data? It loads data into the target device's internal memory from DRAM. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion We should pay attention to the grid in the wrapper code, which is a Tuple of 2 integers. This Tuple describes the number of kernels that will run on a GPU and describes the logical thread space for kernels in terms of blocks, similar to the CUDA programming model. A simple visualization of the kernel's g...
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion In the current example, we are using a single kernel as we wrote it without any actual usage of pid. Grid can also be callable and return a tuple based on meta parameters. This approach will be covered later. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion 1. It works only with shapes that are :math:`2^n` as used in the load operation. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion 2. It does not fully utilize the possibility to use more logical threads. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion To address these issues, let's rewrite it to support any shape. We will use introduce an additional parameter ``BLOCK_SIZE`` to split (or tile) the custom shape according to the suitable granularity of the target GPU. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion # There are multiple 'programs' processing different data. Here, we identify which program ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion # we are in: ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Great! With the first problem resolved, we can now work with arbitrary shapes and sizes of vectors. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
Let's optimize the code to utilize more threads in our grid. Additionally, we can remove the loop from the kernel and convert it into a 1D grid.
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion # There are multiple 'programs' processing different data. Here, we identify which program ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion # we are in: ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Apply corresponding changes to the wrapper: ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion # - `triton.jit`'ed functions can be indexed with a launch grid. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Thread blocks (in the current case, it is a vector with ``BLOCK_SIZE``) are required to execute independently: It must be possible to execute them in any order, either in parallel or in series. This independence requirement allows thread blocks to be scheduled in any order across any number of cores, ena...
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Threads within a block can cooperate by sharing data through some shared memory and by synchronizing their execution to coordinate memory accesses. Here is an example to illustrate memory organization and hierarchy: ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Let's summarize and point out what can be done in the kernel body: ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion # - `triton.jit`'ed functions can be indexed with a launch grid. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
Not clear what the users can do with the instances below, add verbs
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Load and Store Semantics ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion In general, there are several possible storage locations for data in a system that uses a GPU device. The execution unit on the GPU can perform operations with arguments that are stored in the registers of the GPU. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion To manipulate the cache, there are several load/store parameters that specify cache policy and eviction algorithm: ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion 1. ``cache_modifier`` (str, optional) - similar to CUDA load cache parameters ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion However, these parameters are highly dependent on the GPU being used for kernel execution. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion As mentioned earlier, ``tl.load(...)`` loads only a single scalar if a single pointer is passed as an argument. To load a vector or matrix, you need to create ``tl.tensor`` with one of the following `ops <../python-api/triton.language.html#creation-ops>`_: ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Let's explore how to load a matrix using these primitives: ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion # The stride variables indicate how much to increase the pointer when moving by one ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion # element in a specific dimension. For example, `stride_am` represents the increment in `a_ptr` ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion # to access the element one row down (A has M rows). ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Working with matrices often involves manipulating pointers and assuming a specific data order. This can be inconvenient in certain scenarios and forces additional data movement that could be done during compilation. To solve this problem, use ``block_ptr``. ``block_ptr`` simplifies iterating over multi-d...
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion If another kernel is called within the body of this kernel, the Triton compiler will attempt to optimize it by eliminating unnecessary stores to global DRAM memory. Typically, the function will be inlined. Therefor, in complex use cases where the location of the data is important and can be changed at ru...
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Triton has a built-in feature that allows you to choose between several predefined configurations by executing them. This functionality is supported by using the ``@triton.autotune(configs=[...])`` decorator. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion ``triton.Config`` describes several parameters for a kernel. The most important and commonly used parameter is ``meta``, which is a dictionary of meta-parameters passed to the kernel as keyword arguments. Additionally, all ``tl.constexpr`` arguments of the kernel can be passed through ``meta``. Here is a...
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion # The stride variables represent how much to increase the pointer by when moving by one ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion # element in a specific dimension. For example, `stride_am` is how much to increase `a_ptr` ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion To choose the proper block size, you should rely on the documentation of your target GPU. Therefore, it is difficult to provide general recommendations for determining the proper sizes. The effectiveness of block size on your GPU depends on factors such as cache memory capacity, available thread count, a...
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Grid is a logical structure that enables independent execution of all kernels. Therefore, if the data accessed by these kernels intersect, the resulting performance will heavily depend on the traversal order of the grid. Triton's code can be tailored to the specifics of the GPU runtime driver that determ...
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion Additionally, another useful utility is ``@triton.testing.perf_report``, which generates a plot for comparing Triton's implementation with a native implementation or with another Triton implementation. ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -0,0 +1,613 @@ +######################################### +"Hello, World!" and the Programming Model +######################################### + +******** +Glossary +******** + +* **GPU Kernel** (or **kernel**) is a program or function compiled separately from the main program to be executed on a target GPU. Every ...
```suggestion line_arg='provider', # The argument name whose value corresponds to a different line in the plot ```
intel-xpu-backend-for-triton
github_2023
others
636
intel
avladimi
@@ -16,10 +17,29 @@ Getting Started :hidden: getting-started/installation + getting-started/start getting-started/architecture getting-started/tutorials/index +Programming Guide +----------------- + +Check out the following documents to learn more about Triton and how it compares against other D...
```suggestion Check out the following documents to learn more about Triton and its comparison with other DSLs for Deep Neural Networks (DNNs): ```
intel-xpu-backend-for-triton
github_2023
cpp
954
intel
whitneywhtsang
@@ -176,8 +163,8 @@ class TritonLLVMConversionTarget : public ConversionTarget { explicit TritonLLVMConversionTarget(MLIRContext &ctx) : ConversionTarget(ctx) { addLegalDialect<LLVM::LLVMDialect>(); - addIllegalDialect<triton::TritonDialect>(); addIllegalDialect<triton::gpu::TritonGPUDialect>(); ...
Why swap the order?
intel-xpu-backend-for-triton
github_2023
cpp
933
intel
whitneywhtsang
@@ -16,6 +16,7 @@ struct ReturnOpConversion ConversionPatternRewriter &rewriter) const override { auto funcOp = op->getParentOfType<LLVM::LLVMFuncOp>(); if (funcOp->hasAttr("nvvm.kernel")) { + assert(false && "On Intel this code should be unreachable");
change to llvm_unreachable
intel-xpu-backend-for-triton
github_2023
cpp
933
intel
whitneywhtsang
@@ -411,6 +411,7 @@ void createBarrier(ConversionPatternRewriter &rewriter, Location loc, if (numCTAs == 1) {
assert(numCTAs == 1 && ....);
intel-xpu-backend-for-triton
github_2023
cpp
933
intel
whitneywhtsang
@@ -411,6 +411,7 @@ void createBarrier(ConversionPatternRewriter &rewriter, Location loc, if (numCTAs == 1) { barrier(); } else { + assert(false && "Cannot use NVIDIA_GPU operations"); rewriter.create<triton::nvidia_gpu::ClusterArriveOp>(loc, false); rewriter.create<triton::nvidia_gpu::ClusterWa...
remove?
intel-xpu-backend-for-triton
github_2023
python
946
intel
pbchekin
@@ -210,9 +210,7 @@ def add_stages(self, stages, options): @functools.lru_cache() def hash(self): - version = subprocess.check_output([_path_to_binary("spirv-dis")[0], "--version"]) - if type(version) is bytes: - version = version.decode("utf-8") + version = subprocess.check_...
We also probably want to remove end of line from version: ```suggestion version = subprocess.check_output([_path_to_binary("spirv-dis")[0], "--version"], text=True).strip() ```
intel-xpu-backend-for-triton
github_2023
cpp
942
intel
whitneywhtsang
@@ -14,7 +14,7 @@ namespace mlir::triton::intel { class TargetInfo : public mlir::triton::TargetInfoBase { public: - TargetInfo(int computeCapability) : computeCapability(computeCapability) {} + TargetInfo() = default;
Do you think we should pass in device_arch for TargetInfo? (doesn't need to be done in this PR)
intel-xpu-backend-for-triton
github_2023
python
943
intel
pbchekin
@@ -211,6 +211,8 @@ def add_stages(self, stages, options): @functools.lru_cache() def hash(self): version = subprocess.check_output([_path_to_binary("spirv-dis")[0], "--version"]) + if type(version) is bytes:
BTW, this conversion can be avoided if: ``` version = subprocess.check_output([_path_to_binary("spirv-dis")[0], "--version"], text=True) ```
intel-xpu-backend-for-triton
github_2023
python
909
intel
chengjunlu
@@ -4779,6 +4779,11 @@ def compute_rep_shape(layout): warp_shape = np.multiply(layout.sz_per_thread, layout.threads_per_warp) rep_shape = np.multiply(warp_shape, layout.warps_per_cta) return rep_shape + elif type(layout) is DpasLayout: + size_per_thread = [layout.repeatCount * layou...
The warp_shape should be `[layout.repeatCount, layout.execution_size]` I think.
intel-xpu-backend-for-triton
github_2023
python
909
intel
chengjunlu
@@ -4779,6 +4779,11 @@ def compute_rep_shape(layout): warp_shape = np.multiply(layout.sz_per_thread, layout.threads_per_warp) rep_shape = np.multiply(warp_shape, layout.warps_per_cta) return rep_shape + elif type(layout) is DpasLayout: + size_per_thread = [layout.repeatCount * layou...
The logic seems aligned to the BlockLayout. The expression seems to compute the size of `ShapePerCTATile` ``` /* The difference between ShapePerCTATile and ShapePerCTA: * (1) ShapePerCTATile is defined by SizePerThread * ThreadsPerWarp * * WarpsPerCTA in each dimension and is independent from the tensor shap...
intel-xpu-backend-for-triton
github_2023
python
864
intel
whitneywhtsang
@@ -249,7 +249,7 @@ def compile(src, target=None, options=None): # initialize metadata metadata = { "hash": hash, - "target": target, + "target": backend.parse_target(target),
Please create an issue to upstream this change.
intel-xpu-backend-for-triton
github_2023
python
864
intel
whitneywhtsang
@@ -69,15 +69,18 @@ def supports_target(target: tuple): def __init__(self, target: tuple) -> None: super().__init__(target) - assert isinstance(target[1], dict) # TODO: Deprecate capability in XPU compilation # capability should be < 80, because some features in passes with capa...
Why do we want to keep these lines? to be backward compatible?
intel-xpu-backend-for-triton
github_2023
python
864
intel
whitneywhtsang
@@ -69,15 +69,18 @@ def supports_target(target: tuple): def __init__(self, target: tuple) -> None: super().__init__(target) - assert isinstance(target[1], dict) # TODO: Deprecate capability in XPU compilation # capability should be < 80, because some features in passes with capa...
Why do we want to return a tuple instead of dict?
intel-xpu-backend-for-triton
github_2023
python
864
intel
whitneywhtsang
@@ -124,14 +128,14 @@ def make_ttgir(mod, metadata, opt, capability): # TTIR -> TTGIR pm = ir.pass_manager(mod.context) pm.enable_debug() - passes.ttir.add_convert_to_ttgpuir(pm, opt.num_warps, opt.threads_per_warp, opt.num_ctas, capability) + passes.ttir.add_convert_to_ttgpuir(...
Why hard code 80 for capability? It was equal to `intel.passes.ttgpuir.DEVICE_ARCH.PVC` which is 2.
intel-xpu-backend-for-triton
github_2023
python
864
intel
whitneywhtsang
@@ -89,7 +92,8 @@ def _parse_target(self, tgt_prop) -> dict: dev_prop['max_num_sub_groups'] = tgt_prop.get('max_num_sub_groups', None) dev_prop['sub_group_sizes'] = tgt_prop.get('sub_group_sizes', None) dev_prop['has_fp64'] = tgt_prop.get('has_fp64', None)
Are these fields (e.g., has_fp64) defined in `get_device_properties`?