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
python
382
intel
whitneywhtsang
@@ -97,4 +102,10 @@ def matmul_kernel(A, B, C, M, N, K, # BLOCK_N=BLOCK_N, # BLOCK_K=BLOCK_K) - torch.testing.assert_close(out_torch, out_triton, atol=0.3, rtol=0.01) + # For XPU tests torch can compute reference result on CPU using fp32 + # arithmetics for fp16 test. Such reference requi...
```suggestion # arithmetics for fp16 test. Such reference requires additional increased ```
intel-xpu-backend-for-triton
github_2023
others
382
intel
whitneywhtsang
@@ -183,6 +183,11 @@ jobs: cd python/test/unit python3 -m pytest -n 8 --verbose operators + - name: Run partial regression tests + run: | + cd python/test + python3 -m pytest -n 8 --verbose regression/ --ignore=regression/test_performance.py --ignore=regression/test...
To match integreation-tests.yml ```suggestion - name: Regression tests run: | cd python/test/regression python3 -m pytest -vvv -s . --rerun 10 --ignore=test_performance.py --ignore=test_functional_regressions.py ```
intel-xpu-backend-for-triton
github_2023
others
382
intel
etiotto
@@ -183,6 +183,12 @@ jobs: cd python/test/unit python3 -m pytest -n 8 --verbose operators + - name: Regression tests
Can you also add this test to the script "test-triton.sh" ?
intel-xpu-backend-for-triton
github_2023
python
382
intel
etiotto
@@ -7,10 +7,14 @@ """ import pytest import torch +import intel_extension_for_pytorch # type: ignore # noqa: F401 import triton.language as tl from triton import cdiv, jit +# FIXME remove this once Triton L0 queue and IPEX SYCL queue can be synchronized through events +torch.xpu.enable_sync_mode() +
This shouldn't be needed any longer. We use the SYCL RT now rather than L0. Remove ?
intel-xpu-backend-for-triton
github_2023
python
382
intel
etiotto
@@ -97,4 +101,10 @@ def matmul_kernel(A, B, C, M, N, K, # BLOCK_N=BLOCK_N, # BLOCK_K=BLOCK_K) - torch.testing.assert_close(out_torch, out_triton, atol=0.3, rtol=0.01) + # For XPU tests torch can compute reference result on CPU using fp32 + # arithmetics for fp16 test. Such reference requi...
Add a # FIXME marker so that is easy to grep for tests that need to be fixed in the future.
intel-xpu-backend-for-triton
github_2023
others
384
intel
etiotto
@@ -18,7 +18,6 @@ RUN set -ex; \ level-zero \ level-zero-dev libigc-dev intel-igc-cm libigdfcl-dev libigfxcmrt-dev \ ; \ - apt install -y --no-install-recommends --allow-downgrades --fix-missing libigc1=1.0.14828.26-736~22.04; \
The changes to the docker image are being done in a different PR.
intel-xpu-backend-for-triton
github_2023
python
374
intel
LiyangLingIntel
@@ -70,10 +70,12 @@ def get_event_pool(self): def get_sycl_queue(self): import torch - return ipex.xpu.current_stream().sycl_queue + import intel_extension_for_pytorch #noqa
Could you please help remove this line since ipex is imported in the outer scope, we do not need it here.
intel-xpu-backend-for-triton
github_2023
python
374
intel
LiyangLingIntel
@@ -70,10 +70,12 @@ def get_event_pool(self): def get_sycl_queue(self): import torch - return ipex.xpu.current_stream().sycl_queue + import intel_extension_for_pytorch #noqa + return torch.xpu.current_stream().sycl_queue def get_sycl_device(self, device_id): import t...
The same to this line.
intel-xpu-backend-for-triton
github_2023
python
369
intel
whitneywhtsang
@@ -19,8 +19,7 @@ def is_hip(): def is_spirv():
Does it also make sense to rename `is_spirv` to `is_xpu`?
intel-xpu-backend-for-triton
github_2023
python
369
intel
whitneywhtsang
@@ -481,7 +481,9 @@ def get_current_stream(self, device): return torch.xpu.current_stream().sycl_queue def get_current_target(self): - return ("xpu", 0) + device = self.get_current_device()
should we assert `torch.xpu.is_available()` here?
intel-xpu-backend-for-triton
github_2023
python
369
intel
pbchekin
@@ -69,6 +69,8 @@ def get_event_pool(self): return self.event_pool def get_sycl_queue(self): + import torch + assert torch.xpu.is_available()
A good practice is to use assert only in tests and avoid using it for runtime validation since the assert expression is ignored when Python runs in optimized mode, see https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html.
intel-xpu-backend-for-triton
github_2023
python
369
intel
pbchekin
@@ -481,7 +483,10 @@ def get_current_stream(self, device): return torch.xpu.current_stream().sycl_queue def get_current_target(self): - return ("xpu", 0) + device = self.get_current_device() + assert device >= 0
A good practice is to use assert only in tests and avoid using it for runtime validation since the assert expression is ignored when Python runs in optimized mode, see https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html.
intel-xpu-backend-for-triton
github_2023
python
360
intel
whitneywhtsang
@@ -228,7 +229,9 @@ def matmul(a, b): torch_output = torch.matmul(a, b) print(f"triton_output={triton_output}") print(f"torch_output={torch_output}") -if torch.allclose(triton_output, torch_output, atol=1e-2, rtol=0): + +#FIXME: Once tl.dot is lowered to DPAS instructions put back the precision to (atol=1e-2).
Why DPAS would have better accuracy than FMA?
intel-xpu-backend-for-triton
github_2023
python
234
intel
kurapov-peter
@@ -299,13 +302,11 @@ def runner(*args, stream=None): args_expand = driver.assemble_tensormap_to_arg(self.tensormaps_info, args) if self.is_spirv: use_icl = 1 - if stream is None: - dev_obj, ctxt_obj, q_obj = get_dev_ctxt_queue_objs(self.is_sp...
Shouldn't the runner accept a stream? This introduces a circular dependency. Same thing for other instances, I'm not marking them.
intel-xpu-backend-for-triton
github_2023
c
234
intel
kurapov-peter
@@ -99,6 +99,177 @@ static PyObject *getDeviceProperties(PyObject *self, PyObject *args) { mem_bus_width); } +/*Sycl code Start*/ + bool getBoolEnv(const std::string &env) { + const char *s = std::getenv(env.c_str()); + std::string str(s ? s : ""); + st...
This is prone to conflicting with testing frameworks. I'd suggest a few things: - Since this is a specific macro for L0 operations checks (the error message is) rename it to something like THROW_ON_L0_ERROR or similar - Have a single macro or consider a constexpr function instead (even better). Make it accept a f...
intel-xpu-backend-for-triton
github_2023
c
234
intel
kurapov-peter
@@ -99,6 +99,177 @@ static PyObject *getDeviceProperties(PyObject *self, PyObject *args) { mem_bus_width); } +/*Sycl code Start*/ + bool getBoolEnv(const std::string &env) { + const char *s = std::getenv(env.c_str()); + std::string str(s ? s : ""); + st...
How about making the `flag` parameter optional and provide `0` as the default value?
intel-xpu-backend-for-triton
github_2023
c
234
intel
kurapov-peter
@@ -99,6 +99,177 @@ static PyObject *getDeviceProperties(PyObject *self, PyObject *args) { mem_bus_width); } +/*Sycl code Start*/ + bool getBoolEnv(const std::string &env) { + const char *s = std::getenv(env.c_str()); + std::string str(s ? s : ""); + st...
Why is this a vector? There's a single `push_back` in the code.
intel-xpu-backend-for-triton
github_2023
c
234
intel
kurapov-peter
@@ -99,6 +99,177 @@ static PyObject *getDeviceProperties(PyObject *self, PyObject *args) { mem_bus_width); } +/*Sycl code Start*/ + bool getBoolEnv(const std::string &env) { + const char *s = std::getenv(env.c_str()); + std::string str(s ? s : ""); + st...
`binary_size` does not convey additional information about expected format. I'd expect it to be in bytes judging by the type `size_t`. Can we make it explicit by renaming? Like, `binary_size_in_bytes` or similar.
intel-xpu-backend-for-triton
github_2023
c
234
intel
kurapov-peter
@@ -99,6 +99,177 @@ static PyObject *getDeviceProperties(PyObject *self, PyObject *args) { mem_bus_width); } +/*Sycl code Start*/ + bool getBoolEnv(const std::string &env) { + const char *s = std::getenv(env.c_str()); + std::string str(s ? s : ""); + st...
What is the semantics of the `loadSyclBinary`. Is it expected to return a `NULL` on any failure or through an error? Currently there's a mix of approaches: this one returns a `NULL` and L0 calls throw an exception.
intel-xpu-backend-for-triton
github_2023
c
234
intel
kurapov-peter
@@ -99,6 +99,177 @@ static PyObject *getDeviceProperties(PyObject *self, PyObject *args) { mem_bus_width); } +/*Sycl code Start*/ + bool getBoolEnv(const std::string &env) { + const char *s = std::getenv(env.c_str()); + std::string str(s ? s : ""); + st...
Who is responsible for destroying the kernel? And what are we copying it for?
intel-xpu-backend-for-triton
github_2023
python
234
intel
kurapov-peter
@@ -307,7 +310,68 @@ def format_of(ty): PyErr_SetString(PyExc_TypeError, "Pointer argument must be either uint64 or have data_ptr method"); return ptr_info; }} - +// start sycl + static void set_scalar_arg( + sycl::handler& cgh, + int index, + size_t size, + const...
Should the parameters have an unsigned type?
intel-xpu-backend-for-triton
github_2023
python
234
intel
kurapov-peter
@@ -341,7 +406,17 @@ def format_of(ty): if (launch_enter_hook != Py_None) {{ PyObject_CallObject(launch_enter_hook, args); }} - + + void * pStream = PyCapsule_GetPointer(py_obj_stream, "torch.xpu.Stream.sycl_queue"); + //error; + if(pStream == nullptr) return NULL; + + s...
Might be a nullptr dereference
intel-xpu-backend-for-triton
github_2023
c
234
intel
kurapov-peter
@@ -99,6 +99,177 @@ static PyObject *getDeviceProperties(PyObject *self, PyObject *args) { mem_bus_width); } +/*Sycl code Start*/ + bool getBoolEnv(const std::string &env) { + const char *s = std::getenv(env.c_str()); + std::string str(s ? s : ""); + st...
I think we need proper logging.
intel-xpu-backend-for-triton
github_2023
python
234
intel
whitneywhtsang
@@ -9,6 +9,7 @@ from ..runtime.driver import driver # TODO: this shouldn't be here from ..backends.xpu.compiler import InfoFromBackendForTensorMap +
```suggestion ```
intel-xpu-backend-for-triton
github_2023
python
234
intel
whitneywhtsang
@@ -288,8 +289,10 @@ def _init_handles(self): if self.metadata.shared > max_shared: raise OutOfResources(self.metadata.shared, max_shared, "shared memory") # TODO: n_regs, n_spills should be metadata generated when calling `ptxas` - self.module, self.function, self.n_regs, self.n_s...
Please change `driver.get_current_device` for XPU instead.
intel-xpu-backend-for-triton
github_2023
python
234
intel
whitneywhtsang
@@ -300,16 +303,17 @@ def __getitem__(self, grid): self._init_handles() def runner(*args, stream=None): - if stream is None:
Please keep this, and update `driver.get_current_stream` for XPU.
intel-xpu-backend-for-triton
github_2023
python
234
intel
whitneywhtsang
@@ -300,16 +303,17 @@ def __getitem__(self, grid): self._init_handles() def runner(*args, stream=None): - if stream is None: - device = driver.get_current_device() - stream = driver.get_current_stream(device) md = self.metadata args_...
Please update `driver.utils.get_dev_ctxt_queue_objs` for XPU.
intel-xpu-backend-for-triton
github_2023
python
234
intel
whitneywhtsang
@@ -51,18 +51,21 @@ def __init__(self): dirname = os.path.dirname(os.path.realpath(__file__)) mod = compile_module_from_src(Path(os.path.join(dirname, "driver.c")).read_text(), "spirv_utils") self.load_binary = mod.load_binary + self.load_sycl_binary = mod.load_sycl_binary sel...
Since ``` def get_current_stream(self, device): import torch return torch.xpu.current_stream().sycl_queue ``` ```suggestion self.context = mod.init_context(self.get_sycl_queue()) self.device_count = mod.init_devices(self.get_sycl_queue()) ```
intel-xpu-backend-for-triton
github_2023
c
234
intel
whitneywhtsang
@@ -108,141 +108,146 @@ static PyObject *getDeviceProperties(PyObject *self, PyObject *args) { } /*Sycl code Start*/ - bool getBoolEnv(const std::string &env) { - const char *s = std::getenv(env.c_str()); - std::string str(s ? s : ""); - std::transform(str.begin(), str.end(),...
Can we please also remove the commented out print lines?
intel-xpu-backend-for-triton
github_2023
c
234
intel
kurapov-peter
@@ -56,13 +57,17 @@ static PyObject *getDeviceProperties(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "i", &device_id)) return NULL; - if (device_id > devices.size()) { - std::cerr << "Device ID not found: " << device_id << std::endl; + if (device_id > sycl_l0_device_map.size()) { + s...
Does this rely on some order in the unordered map?
intel-xpu-backend-for-triton
github_2023
python
234
intel
kurapov-peter
@@ -70,11 +71,15 @@ def get_event_pool(self): def get_sycl_queue(self): return ipex.xpu.current_stream().sycl_queue + def get_sycl_device(self, device_id): + import torch + return torch.xpu.device(device_id).sycl_device + def get_dev_ctxt_queue_objs(self): - context = self.g...
If this doesn't do anything, can we remove the method?
intel-xpu-backend-for-triton
github_2023
python
234
intel
kurapov-peter
@@ -357,7 +436,7 @@ def format_of(ty): (ze_kernel_handle_t)_function, (ze_event_pool_handle_t)_event_pool {', ' + ', '.join(f"(void *) _arg{i}" if ty[0]=="*" else f"_arg{i}" for i, ty in signature.items()) if len(signature) > 0 else ''}); }} - +*/
Could you please clean up all the commented out code?
intel-xpu-backend-for-triton
github_2023
python
234
intel
whitneywhtsang
@@ -314,7 +314,7 @@ def _init_handles(self): raise OutOfResources(self.metadata.shared, max_shared, "shared memory") # TODO: n_regs, n_spills should be metadata generated when calling `ptxas` self.module, self.function, self.n_regs, self.n_spills = driver.active.utils.load_binary( - ...
Please guide this change under `if driver.active.get_current_target()[0] == "xpu":`.
intel-xpu-backend-for-triton
github_2023
python
352
intel
whitneywhtsang
@@ -317,8 +317,9 @@ def test_layer_norm(M, N, dtype, eps=1e-5, device='xpu'): # compare assert torch.allclose(y_tri, y_ref, atol=1e-2, rtol=0) assert torch.allclose(dx_tri, dx_ref, atol=1e-2, rtol=0) - assert torch.allclose(db_tri, db_ref, atol=1e-2, rtol=0) + #FIXME tolerance was increased from 1e...
```suggestion assert torch.allclose(db_tri, db_ref, atol=1e-2, rtol=0) # FIXME: tolerance was increased from 1e-2 to 2e-2 to allow test to run assert torch.allclose(dw_tri, dw_ref, atol=2e-2, rtol=0) ```
intel-xpu-backend-for-triton
github_2023
python
352
intel
whitneywhtsang
@@ -208,6 +208,7 @@ def group_gemm_fn(group_A, group_B): tri_out = group_gemm_fn(group_A, group_B) ref_out = [torch.matmul(a, b) for a, b in zip(group_A, group_B)] for i in range(group_size): + #FIXME tolerance was increased from 1e-2 to 3e-2 to allow test to run
```suggestion # FIXME: tolerance was increased from 1e-2 to 3e-2 to allow test to run ```
intel-xpu-backend-for-triton
github_2023
cpp
279
intel
kurapov-peter
@@ -790,6 +790,43 @@ Bf16_to_Fp8E4M3Nv_func(Location loc, ConversionPatternRewriter &rewriter, extract_element(i8_ty, fp8x4Vec, i32_val(3))}; } +static SmallVector<Value> Bf16_to_Fp16_func(Location loc, + ConversionPatternRewriter &rewriter, + ...
Out of curiosity, where do all these values come from?
intel-xpu-backend-for-triton
github_2023
cpp
279
intel
etiotto
@@ -790,6 +790,43 @@ Bf16_to_Fp8E4M3Nv_func(Location loc, ConversionPatternRewriter &rewriter, extract_element(i8_ty, fp8x4Vec, i32_val(3))}; } +static SmallVector<Value> Bf16_to_Fp16_func(Location loc,
So far we haven't had a need to add conversion functions that NVidia doesn't have. I am wondering what is special about this one (why NVidia doesn't need it) ?
intel-xpu-backend-for-triton
github_2023
others
328
intel
etiotto
@@ -35,24 +35,15 @@ pip install -U --index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/ # Install from source ``` -git clone https://github.com/openai/triton.git; -cd triton; - -pip install ninja cmake wheel; # build-time dependencies -pip install -e python +git clone https://github.com/intel/intel-xpu...
cd intel-xpu-backend-for-triton
intel-xpu-backend-for-triton
github_2023
others
328
intel
bader
@@ -35,24 +35,17 @@ pip install -U --index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/ # Install from source ``` -git clone https://github.com/openai/triton.git; -cd triton; - -pip install ninja cmake wheel; # build-time dependencies -pip install -e python +git clone https://github.com/intel/intel-xpu...
IMHO, it make sense to drop > We're hiring! If you are interested in working on Triton at OpenAI, we have roles open for [Compiler Engineers](https://openai.com/careers/software-engineer-triton-compiler) and [Kernel Engineers](https://openai.com/careers/kernel-engineer). from the beginning of the README file. ;)
intel-xpu-backend-for-triton
github_2023
others
83
intel
Stonepia
@@ -0,0 +1,230 @@ +#!/usr/bin/env bash +# +# Please review the system requirements before running this script +# https://intel.github.io/intel-extension-for-pytorch/xpu/latest/tutorials/installation.html +# +set -ueo pipefail + +#VER_LLVM="triton_debug" +#VER_PYTORCH="v2.0.1" +VER_TORCHVISION="v0.15.2" +VER_TORCHAUDIO=...
This LLVM is not needed. We could delete this.
intel-xpu-backend-for-triton
github_2023
others
83
intel
Stonepia
@@ -0,0 +1,230 @@ +#!/usr/bin/env bash +# +# Please review the system requirements before running this script +# https://intel.github.io/intel-extension-for-pytorch/xpu/latest/tutorials/installation.html +# +set -ueo pipefail + +#VER_LLVM="triton_debug" +#VER_PYTORCH="v2.0.1" +VER_TORCHVISION="v0.15.2" +VER_TORCHAUDIO=...
No need to build llvm ourselves.
intel-xpu-backend-for-triton
github_2023
others
83
intel
Stonepia
@@ -0,0 +1,230 @@ +#!/usr/bin/env bash +# +# Please review the system requirements before running this script +# https://intel.github.io/intel-extension-for-pytorch/xpu/latest/tutorials/installation.html +# +set -ueo pipefail + +#VER_LLVM="triton_debug" +#VER_PYTORCH="v2.0.1" +VER_TORCHVISION="v0.15.2" +VER_TORCHAUDIO=...
no need for llvm
intel-xpu-backend-for-triton
github_2023
others
83
intel
Stonepia
@@ -0,0 +1,230 @@ +#!/usr/bin/env bash +# +# Please review the system requirements before running this script +# https://intel.github.io/intel-extension-for-pytorch/xpu/latest/tutorials/installation.html +# +set -ueo pipefail + +#VER_LLVM="triton_debug" +#VER_PYTORCH="v2.0.1" +VER_TORCHVISION="v0.15.2" +VER_TORCHAUDIO=...
The source of `DPCPP_ENV` and `ONEMKL_ENV` should be only during building the Intel® Extension for PyTorch, other components may link to the wrong mkl path if these two are sourced. However, this error was only discovered when building PyTorch, so I think sourcing them here is acceptable. Just a note here.
intel-xpu-backend-for-triton
github_2023
others
83
intel
Stonepia
@@ -0,0 +1,230 @@ +#!/usr/bin/env bash +# +# Please review the system requirements before running this script +# https://intel.github.io/intel-extension-for-pytorch/xpu/latest/tutorials/installation.html +# +set -ueo pipefail + +#VER_LLVM="triton_debug" +#VER_PYTORCH="v2.0.1" +VER_TORCHVISION="v0.15.2" +VER_TORCHAUDIO=...
I don't know if building torchvision / torchaudio is needed in the Triton repo. Triton is not dependent on them neither in building or in running. Thus I prefer not to add them.
intel-xpu-backend-for-triton
github_2023
others
115
intel
Stonepia
@@ -150,15 +177,66 @@ jobs: exit 1 fi - - name: UT Log Preview + - name: Unit Test for triton on ATSM + if: ${{ env.BACKEND == 'ATSM'}} + shell: bash + run: | + echo -e "[ INFO ] Run UT test on Node $(hostname)" + source ${HOME}/miniconda3/bin/a...
For ATSM, the ZE_AFFINITY_MASK should be set to `0.0` I think? It has only one card
intel-xpu-backend-for-triton
github_2023
others
115
intel
chuanqi129
@@ -150,15 +177,45 @@ jobs: exit 1 fi - - name: UT Log Preview + - name: Unit Test for triton on ATSM + if: ${{ env.BACKEND == 'ATSM'}} + shell: bash + run: | + echo -e "[ INFO ] Run UT test on Node $(hostname)" + source ${HOME}/miniconda3/bin/a...
If we don't add `env.BACKEND` check for this step, whether it can share with all BACKEND? If so, we can reduce some redundant steps.
intel-xpu-backend-for-triton
github_2023
python
319
intel
etiotto
@@ -164,16 +164,13 @@ def triton_(in_ptr0, out_ptr0, XBLOCK: tl.constexpr): @pytest.mark.parametrize("RBLOCK", [1, 16, 32, 64, 128]) @pytest.mark.parametrize("num_warps", [1, 4]) def test_scan2d_broadcast(RBLOCK, num_warps): - pytest.skip("FIXME: worker crashed cases") @triton.jit(debug=True) def fn(i...
I know there is a codegen issue with `tl.device_assert` but removing sidesteps that problem and introduces a difference with upstream code.
intel-xpu-backend-for-triton
github_2023
python
319
intel
whitneywhtsang
@@ -17,14 +17,13 @@ for mode in ['forward', 'backward'] ]) def test_op(M, N, dtype, mode): - pytest.skip("FIXME: Port get_device_capability to XPU") - capability = torch.cuda.get_device_capability() + capability = (100, 100)
``` if torch.cuda.is_available(): capability = torch.cuda.get_device_capability() if capability[0] < 8 and dtype == "bfloat16": pytest.skip("Only test bfloat16 on devices with sm >= 80") ```
intel-xpu-backend-for-triton
github_2023
python
315
intel
etiotto
@@ -374,7 +377,7 @@ def gbps(ms): test_layer_norm(1151, 8192, torch.float16) -bench_layer_norm.run(save_path='.', print_data=True) +bench_layer_norm.run(print_data=True)
why do we need this change ?
intel-xpu-backend-for-triton
github_2023
cpp
303
intel
whitneywhtsang
@@ -126,32 +126,13 @@ struct PrintOpConversion matchAndRewrite(triton::PrintOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { auto loc = op->getLoc(); - if (target == Target::GENX) { - SmallVector<Value, 16> operands; - for (size_t i = 0; i < op.getN...
Can you please explain why this is needed?
intel-xpu-backend-for-triton
github_2023
others
303
intel
whitneywhtsang
@@ -159,17 +159,13 @@ jobs: pip install torch==2.1.0a0+cxx11.abi intel_extension_for_pytorch==2.1.10+xpu -f https://developer.intel.com/ipex-whl-stable-xpu cd python/test/unit python3 -m pytest -n 8 --verbose --device xpu language/ --ignore=language/test_line_info.py --ignore=language/t...
Why this test doesn't need to be run serially for NV? ```suggestion # run test_subprocess.py serially to avoid issues with print buffer handling. ```
intel-xpu-backend-for-triton
github_2023
cpp
306
intel
whitneywhtsang
@@ -2294,15 +2294,21 @@ struct MinMaxFOpConversion using Adaptor = typename Base::OpAdaptor; static_assert(std::is_same<OpTy, arith::MinimumFOp>::value || - std::is_same<OpTy, arith::MaximumFOp>::value, - "OpTy must be arith::MinimumFOp or arith::MaximumFOp"); + ...
```suggestion "arith::MinNumFOp/arith::MaxNumFOp"); ```
intel-xpu-backend-for-triton
github_2023
cpp
306
intel
whitneywhtsang
@@ -2627,8 +2634,19 @@ void mlir::triton::populateElementwiseOpToLLVMPatterns( benefit); patterns.add<ClampFOpConversion>(typeConverter, axisInfoAnalysis, computeCapability, target); + // TODO(FIXME): spirv's OpenCL extension (fmin/fmax) doe...
Which patterns creates the spirv's OpenCL extension (fmin/fmax)?
intel-xpu-backend-for-triton
github_2023
cpp
306
intel
whitneywhtsang
@@ -2627,8 +2634,19 @@ void mlir::triton::populateElementwiseOpToLLVMPatterns( benefit); patterns.add<ClampFOpConversion>(typeConverter, axisInfoAnalysis, computeCapability, target); + // TODO(FIXME): spirv's OpenCL extension (fmin/fmax) doe...
From the modified pattern, `arith::MinNumFOp` is lowered to `LLVM::MinNumFOp` `arith::MaxNumFOp` is lowered to `LLVM::MaxNumFOp` which is the same as (at line 2561) ``` POPULATE_BINARY_OP( arith::MinNumFOp, LLVM::MinNumOp) // fmin (return non-NaN if either op is non-NaN) POPULATE_BINARY_OP( ...
intel-xpu-backend-for-triton
github_2023
others
299
intel
whitneywhtsang
@@ -166,7 +166,8 @@ function run_tutorial_tests { run_tutorial_test "01-vector-add" 01-vector-add.py run_tutorial_test "02-fused-softmax" 02-fused-softmax.py - run_tutorial_test "03-matrix-multiplication" 03-matrix-multiplication.py + # run_tutorial_test "03-matrix-multiplication" 03-matrix-multiplication.py ...
Let's just remove it.
intel-xpu-backend-for-triton
github_2023
others
299
intel
whitneywhtsang
@@ -198,6 +198,7 @@ jobs: cd python/tutorials python3 01-vector-add.py python3 02-fused-softmax.py + python3 04-low-memory-dropout
```suggestion python3 04-low-memory-dropout.py ```
intel-xpu-backend-for-triton
github_2023
others
299
intel
whitneywhtsang
@@ -198,6 +198,7 @@ jobs: cd python/tutorials
Need to also install `tabulate` on line 197.
intel-xpu-backend-for-triton
github_2023
others
296
intel
ienkovich
@@ -119,6 +135,14 @@ fi function build_triton { echo "**** Configuring $TRITON_PROJ ****" cd $TRITON_PROJ + + if [ "$VENV" = true ]; then + echo "**** Creating Python virtualenv ****" + python3 -m venv .venv --prompt triton + source .venv/bin/activate + pip install ninja cmake wheel
If you want to use cmake from the virtual env then you need to fix the CMAKE definition which is now unconditionally `CMAKE=/usr/bin/cmake`
intel-xpu-backend-for-triton
github_2023
others
247
intel
etiotto
@@ -58,7 +58,7 @@ if [ ! -d "$LLVM_PROJ" ]; then echo "**** Cloning $LLVM_PROJ ****" cd $BASE - git clone --recursive https://github.com/intel/llvm.git -b genx + git clone --recursive https://github.com/alexbaden/llvm.git -b alex/use_igc_intrinsics
This was left over unintentionally correct ? We should be using the `genx` branch from the Intel LLVM monorepo.
intel-xpu-backend-for-triton
github_2023
others
239
intel
pbchekin
@@ -1,4 +1,4 @@ -ARG INSTALLER_IMAGE=docker-registry.docker-registry.svc.cluster.local:5000/oneapi-basekit:2023.2.0 +ARG INSTALLER_IMAGE=docker-registry.docker-registry.svc.cluster.local:5000/oneapi-basekit:2024.0
2024.0.1 is the latest one. ```suggestion ARG INSTALLER_IMAGE=docker-registry.docker-registry.svc.cluster.local:5000/oneapi-basekit:2024.0.1 ```
intel-xpu-backend-for-triton
github_2023
others
239
intel
pbchekin
@@ -20,7 +20,7 @@ jobs: run: | docker build .github/dockerfiles/runner-base/ \ --tag $REGISTRY/$TAG \ - --build-arg INSTALLER_IMAGE=$REGISTRY/oneapi-basekit:2023.2.0 + --build-arg INSTALLER_IMAGE=$REGISTRY/oneapi-basekit:2024.0
```suggestion --build-arg INSTALLER_IMAGE=$REGISTRY/oneapi-basekit:2024.0.1 ```
intel-xpu-backend-for-triton
github_2023
python
239
intel
vlad-penkin
@@ -131,7 +131,7 @@ def format_of(ty): char err[1024] = {{0}}; strcat(err, prefix); strcat(err, str.c_str()); - PyErr_SetString(PyExc_RuntimeError, err); + //PyErr_SetString(PyExc_RuntimeError, err);
@pbchekin let's switch to Agama 775.20 release which should work with oneAPI 2024.0.1/2: https://dgpu-docs.intel.com/releases/stable_775_20_20231219.html
intel-xpu-backend-for-triton
github_2023
others
239
intel
pbchekin
@@ -19,9 +19,9 @@ RUN set -ex; \ curl -s https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor --output /usr/share/keyrings/oneapi-archive-keyring.gpg; \ apt-get update -y; \ apt-get install -y --no-install-recommends --fix-missing \ - intel-level-zero-gpu \ - ...
This does not work: ``` # apt-get install -y --no-install-recommends --fix-missing \ intel-level-zero-gpu=1.3.27191.42-775~22.04 \ level-zero=1.14.0-744~22.04 \ level-zero-dev=1.14.0-744~22.04 ... E: Version '1.3.27191.42-775~22.04' for 'intel-level-zero-gpu' was not found E: Version '1.14.0-7...
intel-xpu-backend-for-triton
github_2023
c
264
intel
etiotto
@@ -0,0 +1,312 @@ +#include <cstddef> +#include <string> +#include <vector> +#include <unordered_map> +#include <variant> +#include <iostream> +#include <level_zero/ze_api.h> +#include <sycl/sycl.hpp> + +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#include <Python.h> +#include <numpy/arrayobject.h> + +typedef st...
Remove commented out code.
intel-xpu-backend-for-triton
github_2023
c
264
intel
etiotto
@@ -0,0 +1,312 @@ +#include <cstddef> +#include <string> +#include <vector> +#include <unordered_map> +#include <variant> +#include <iostream> +#include <level_zero/ze_api.h> +#include <sycl/sycl.hpp> + +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#include <Python.h> +#include <numpy/arrayobject.h> + +typedef st...
Remove
intel-xpu-backend-for-triton
github_2023
c
264
intel
etiotto
@@ -0,0 +1,312 @@ +#include <cstddef> +#include <string> +#include <vector> +#include <unordered_map> +#include <variant> +#include <iostream> +#include <level_zero/ze_api.h> +#include <sycl/sycl.hpp> + +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#include <Python.h> +#include <numpy/arrayobject.h> + +typedef st...
Have you run clang-format on this file. The formatting is different that the rest of the C/C++ code in the project.
intel-xpu-backend-for-triton
github_2023
c
264
intel
etiotto
@@ -0,0 +1,312 @@ +#include <cstddef>
Add the copyright notice to the new file please.
intel-xpu-backend-for-triton
github_2023
c
264
intel
etiotto
@@ -0,0 +1,312 @@ +#include <cstddef> +#include <string> +#include <vector> +#include <unordered_map> +#include <variant> +#include <iostream> +#include <level_zero/ze_api.h> +#include <sycl/sycl.hpp> + +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#include <Python.h> +#include <numpy/arrayobject.h> + +typedef st...
Error condition should not be emitted to stdout. Use stderr please.
intel-xpu-backend-for-triton
github_2023
c
264
intel
etiotto
@@ -0,0 +1,312 @@ +#include <cstddef> +#include <string> +#include <vector> +#include <unordered_map> +#include <variant> +#include <iostream> +#include <level_zero/ze_api.h> +#include <sycl/sycl.hpp> + +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#include <Python.h> +#include <numpy/arrayobject.h> + +typedef st...
Traces are useful but we should use LLVM's tracing infrastructure to emit them (LLVM_DEBUG).
intel-xpu-backend-for-triton
github_2023
c
264
intel
etiotto
@@ -0,0 +1,312 @@ +#include <cstddef> +#include <string> +#include <vector> +#include <unordered_map> +#include <variant> +#include <iostream> +#include <level_zero/ze_api.h> +#include <sycl/sycl.hpp> + +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#include <Python.h> +#include <numpy/arrayobject.h> + +typedef st...
Use `llvm::errs`
intel-xpu-backend-for-triton
github_2023
python
227
intel
etiotto
@@ -55,10 +61,12 @@ def kernel_dot(Z): tl.store(Z + offs, z) src = ASTSource(fn=kernel_dot, signature={0: "*fp32"}, attrs=attrs, constants=dict()) - triton.compile(src=src, target=("cuda", capability)) + triton.compile(src=src, target=("xpu", capability)) def test_compile_in_forked_subproc() ...
What is the issue to track this problem ?
intel-xpu-backend-for-triton
github_2023
python
227
intel
etiotto
@@ -30,10 +34,12 @@ def kernel_sub(a, b, o, N: tl.constexpr): signature={0: "*fp32", 1: "*fp32", 2: "*fp32"}, attrs=attrs, ) - triton.compile(src=src, target=("cuda", capability)) + triton.compile(src=src, target=("xpu", capability)) def test_compile_in_subproc() -> None: + pytest.s...
What is the issue to track this problem ?
intel-xpu-backend-for-triton
github_2023
python
227
intel
etiotto
@@ -257,3 +260,5 @@ def kernel(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr): x0 = xindex tmp0 = tl.load(in_ptr0 + (x0), xmask) tl.store(out_ptr0 + (x0 + tl.zeros([XBLOCK], tl.int32)), tmp0, xmask) + + reset_tmp_dir()
why do we need this ?
intel-xpu-backend-for-triton
github_2023
others
246
intel
whitneywhtsang
@@ -70,6 +70,25 @@ jobs: python3 assert_helper.py device_assert python3 print_helper.py device_print float 1> /dev/null + - name: Clear cache + run: | + rm -rf ~/.triton + + - name: Run interpreter tests + env: + # TRITON_INTERPRET: "1" + CUA_VI...
`integration-tests.yml` doesn't check for BACKEND here. ```suggestion ```
intel-xpu-backend-for-triton
github_2023
others
246
intel
whitneywhtsang
@@ -122,6 +122,12 @@ function run_core_tests { echo "FAILED: return code $?" ; exit $? fi + cd $CORE_TEST_DIR/operators
nit: follow the same order as ci testing, run runtime testing before operators.
intel-xpu-backend-for-triton
github_2023
others
246
intel
etiotto
@@ -122,6 +122,12 @@ function run_core_tests { echo "FAILED: return code $?" ; exit $? fi + cd $CORE_TEST_DIR/operators + TRITON_DISABLE_LINE_INFO=1 python3 -m pytest -n 8 --verbose
[nit]: Either remove `-n 8` here or also add it to the runtime tests ?
intel-xpu-backend-for-triton
github_2023
python
246
intel
etiotto
@@ -102,6 +105,7 @@ ) def test_op(BLOCK_M, BLOCK_N, BLOCK_K, SPLIT_K, NWARP, NSTAGE, M, N, K, AT, BT, ADTYPE, BDTYPE, ALLOW_TF32, F8_FASTACCUM, ACC_DTYPE, OUTPUT_DTYPE): + pytest.skip("FIXME: Port get_device_capability to XPU")
Have you opened an issue to track this problem ?
intel-xpu-backend-for-triton
github_2023
python
246
intel
etiotto
@@ -20,7 +23,7 @@ def test_op(Z, H, N_CTX, D_HEAD, dtype, causal, seq_par): if enable_tma in ["on", "true", "1"]: if dtype == torch.bfloat16: pytest.skip('bfloat16 tma not support currently') - + pytest.skip("FIXME: Port get_device_capability to XPU")
Have you opened an issue to track this problem ?
intel-xpu-backend-for-triton
github_2023
python
246
intel
etiotto
@@ -13,6 +16,7 @@ for mode in ['forward', 'backward'] ]) def test_op(M, N, dtype, mode): + pytest.skip("FIXME: Port get_device_capability to XPU")
Have you opened an issue to track this problem ?
intel-xpu-backend-for-triton
github_2023
python
246
intel
etiotto
@@ -152,6 +157,7 @@ def test_attention_fwd_bwd( batch_size=2, n_heads=2, ): + pytest.skip("FIXME: Port get_device_capability to XPU")
Have you opened an issue to track this problem ?
intel-xpu-backend-for-triton
github_2023
others
258
intel
etiotto
@@ -100,30 +100,31 @@ function run_core_tests { if [ ! -d "${CORE_TEST_DIR}" ]; then echo "Not found '${CORE_TEST_DIR}'. Build Triton please" ; exit 3 fi + cd ${CORE_TEST_DIR} - cd $CORE_TEST_DIR/language - TRITON_DISABLE_LINE_INFO=1 python3 -m pytest --verbose --device xpu --ignore=test_line_info.py --...
Looks like the same as upstream Triton, which is great. Thank you.
intel-xpu-backend-for-triton
github_2023
cpp
204
intel
whitneywhtsang
@@ -919,10 +920,29 @@ struct ConvertTritonGPUToLLVM static Value promoteOperand(OpBuilder &builder, Location loc, Value operand, Type promotedType) { - Type tensorPromotedType = + auto tensorPromotedType = operand.getType().cast<RankedTensorType>().cloneWith(std::nullo...
```suggestion ```
intel-xpu-backend-for-triton
github_2023
cpp
204
intel
whitneywhtsang
@@ -919,10 +920,29 @@ struct ConvertTritonGPUToLLVM static Value promoteOperand(OpBuilder &builder, Location loc, Value operand, Type promotedType) { - Type tensorPromotedType = + auto tensorPromotedType = operand.getType().cast<RankedTensorType>().cloneWith(std::nullo...
```suggestion ```
intel-xpu-backend-for-triton
github_2023
cpp
204
intel
whitneywhtsang
@@ -919,10 +920,29 @@ struct ConvertTritonGPUToLLVM static Value promoteOperand(OpBuilder &builder, Location loc, Value operand, Type promotedType) { - Type tensorPromotedType = + auto tensorPromotedType =
```suggestion Type tensorPromotedType = ```
intel-xpu-backend-for-triton
github_2023
others
242
intel
whitneywhtsang
@@ -104,7 +104,10 @@ jobs: # Increase this value to reset cache CACHE_NUMBER: 1 run: | - PACKAGES_CACHE_KEY="packages-${{ hashFiles('scripts/compile-triton.sh', 'cmake/llvm-hash.txt') }}-${{ env.CACHE_NUMBER }}" + LLVM_COMMIT_ID=$(git ls-remote https://github.com/intel/l...
Don't think we still need to track `cmake/llvm-hash.txt`.
intel-xpu-backend-for-triton
github_2023
others
242
intel
alexbaden
@@ -104,7 +104,10 @@ jobs: # Increase this value to reset cache CACHE_NUMBER: 1 run: | - PACKAGES_CACHE_KEY="packages-${{ hashFiles('scripts/compile-triton.sh', 'cmake/llvm-hash.txt') }}-${{ env.CACHE_NUMBER }}" + LLVM_COMMIT_ID=$(git ls-remote https://github.com/intel/l...
Nice!
intel-xpu-backend-for-triton
github_2023
others
209
intel
whitneywhtsang
@@ -0,0 +1,96 @@ +name: Build and test + +on: + workflow_dispatch: + pull_request: + branches: + - llvm-target + +env: + BASE: /home/runner + LLVM_SYSPATH: /home/runner/packages/llvm + BACKEND: XPU + TRITON_DISABLE_LINE_INFO: 1 + +jobs: + build: + runs-on: + - glados + - spr + - pvc + ...
Why `source ~/intel/oneapi/setvars.sh` needs to be run more than once?
intel-xpu-backend-for-triton
github_2023
others
209
intel
whitneywhtsang
@@ -0,0 +1,96 @@ +name: Build and test + +on: + workflow_dispatch: + pull_request: + branches: + - llvm-target + +env: + BASE: /home/runner + LLVM_SYSPATH: /home/runner/packages/llvm
We would like to have this file more similar to the upstream https://github.com/intel/intel-xpu-backend-for-triton/blob/llvm-target/.github/workflows/integration-tests.yml, e.g., setting environment variables like: `echo "TRITON_DISABLE_LINE_INFO=1" >> "${GITHUB_ENV}"`, is that possible?
intel-xpu-backend-for-triton
github_2023
others
209
intel
whitneywhtsang
@@ -0,0 +1,96 @@ +name: Build and test + +on: + workflow_dispatch: + pull_request: + branches: + - llvm-target + +env: + BASE: /home/runner + LLVM_SYSPATH: /home/runner/packages/llvm + BACKEND: XPU + TRITON_DISABLE_LINE_INFO: 1 + +jobs: + build: + runs-on: + - glados + - spr + - pvc + ...
This is updated by recent PRs, test_block_pointer.py and test_line_info.py are now being run. How about change this to ```suggestion - name: Run python tests on XPU if: ${{ env.BACKEND == 'XPU'}} run: | source ~/intel/oneapi/setvars.sh pip install pytest pytest-xdist ...
intel-xpu-backend-for-triton
github_2023
others
209
intel
alexbaden
@@ -0,0 +1,113 @@ +name: Build and test + +on: + workflow_dispatch: + pull_request: + branches: + - llvm-target + +env: + BASE: /home/runner + LLVM_SYSPATH: /home/runner/packages/llvm + BACKEND: XPU + TRITON_DISABLE_LINE_INFO: 1 + +jobs: + pre-commit: + name: Pre-commit checks + runs-on: + - g...
@pbchekin @whitneywhtsang When we run `scripts/compile-triton.sh` we pull the latest commit from the `genx` branch, but this commit referenced here appears to be quite a bit older.
intel-xpu-backend-for-triton
github_2023
python
118
intel
chengjunlu
@@ -10,15 +10,44 @@ import torch import triton._C.libintel_xpu_backend_for_triton.triton as _triton # noqa:E402 from triton._C.libtriton.triton import ir as triton_ir -from triton.common.backend import BaseBackend, register_backend # noqa:E402 +from triton.common.backend import (TRITON_PATH, TRITON_VERSION, # noq...
We don't use the ptxas tools. We can skip this.
intel-xpu-backend-for-triton
github_2023
python
118
intel
chengjunlu
@@ -10,15 +10,44 @@ import torch import triton._C.libintel_xpu_backend_for_triton.triton as _triton # noqa:E402 from triton._C.libtriton.triton import ir as triton_ir -from triton.common.backend import BaseBackend, register_backend # noqa:E402 +from triton.common.backend import (TRITON_PATH, TRITON_VERSION, # noq...
We uses the libxpu_intel_backend.so. Add that library as part of the hash key.
intel-xpu-backend-for-triton
github_2023
others
118
intel
chuanqi129
@@ -1,11 +1,11 @@ JOB_WORKSPACE=${1:-triton-preci} TORCH_REPO=${2:-https://github.com/pytorch/pytorch.git} -TORCH_BRANCH=${3:-v2.0.1} -TORCH_COMMIT=${4:-e9ebda29d87ce0916ab08c06ab26fd3766a870e5} +TORCH_BRANCH=${3:-release/2.1}
does this branch based on pytorch v2.1?
intel-xpu-backend-for-triton
github_2023
others
217
intel
whitneywhtsang
@@ -23,13 +23,27 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Check if pip cache exists
Why do we need to use cache for pre-commit checks? Pre-commit checks should be fast.
intel-xpu-backend-for-triton
github_2023
python
197
intel
etiotto
@@ -3302,7 +3302,21 @@ def _kernel(dst): @pytest.mark.parametrize("dtype_str, expr, lib_path", [('int32', 'math.ffs', ''), ('float32', 'math.log2', ''), ('float32', 'math.scalbn', ''), ('float32', 'math.pow'...
I am a bit conflicted about adding new tests in this file. One one hand expanding on tests give us more functional coverage, on the other hand it increases divergence from upstream code. I wonder whether the math functions you added are already tested in some other python test file. Do you know (can you check) ? @w...
intel-xpu-backend-for-triton
github_2023
python
190
intel
whitneywhtsang
@@ -109,15 +125,16 @@ def check_file_lines(file_lines, file_name, lineno, should_contain=True): return not should_contain -func_types = ["single", "call", "call_noinline", "multi_files", "autotune", "dot_combine"] - +#TODO: dot_combine fails to compile. +#func_types = ["single", "call", "call_noinline", "multi...
[nit] ```suggestion # TODO: dot_combine fails to compile. # func_types = ["single", "call", "call_noinline", "multi_files", "autotune", "dot_combine"] ```
intel-xpu-backend-for-triton
github_2023
python
190
intel
whitneywhtsang
@@ -154,7 +172,6 @@ def test_line_info(func: str): assert (check_file_lines(file_lines, "standard.py", 34)) assert (check_file_lines(file_lines, "standard.py", 36)) elif func == "autotune": - assert (check_file_lines(file_lines, "test_line_info.py", 60))
Why this assert is removed?
intel-xpu-backend-for-triton
github_2023
others
187
intel
whitneywhtsang
@@ -6,4 +9,9 @@ add_mlir_translation_library(TritonSPIRV LINK_LIBS PUBLIC TritonLLVMIR + # spirv tools + LLVMSPIRVLib ) + +# Add SPIRVLLVMTranslator include dir
nit: consistent name ```suggestion # Add SPIRV-LLVM-Translator include directory. ```
intel-xpu-backend-for-triton
github_2023
others
187
intel
whitneywhtsang
@@ -1,3 +1,6 @@ +# SPIRV-LLVM Translator is required.
nit: consistent name ```suggestion # SPIRV-LLVM-Translator is required. ```
intel-xpu-backend-for-triton
github_2023
others
187
intel
whitneywhtsang
@@ -0,0 +1 @@ +08885516deabe3b51c8bc801fd8997b794e9d698
Any reasons you picked this commit? 0166a0fb86dc6c0e8903436bbc3a89bc3273ebc0 is later, and it works.