Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMD] Treat version as string avoid string/bytes comparison #3428

Merged
merged 2 commits into from
Mar 24, 2024

Conversation

jataylo
Copy link
Contributor

@jataylo jataylo commented Mar 21, 2024

Resolves an error observed as part of inductor support bring-up for AMD when running unit test's via PyTorch's run_test.py due to the addition of -bb flag in pytest which forbids string/bytes comparisons.

  File "/opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_inductor/triton_heuristics.py", line 208, in precompile
    compiled_binary, launcher = self._precompile_config(
  File "/opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_inductor/triton_heuristics.py", line 365, in _precompile_config
    binary = triton.compile(*compile_args, **compile_kwargs)
  File "/root/triton/python/triton/compiler/compiler.py", line 229, in compile
    key = f"{triton_key()}-{src.hash()}-{backend.hash()}-{options.hash()}-{str(sorted(get_env_vars().items()))}"
  File "/root/triton/python/triton/backends/amd/compiler.py", line 231, in hash
    return f'{version}-{self.target}'
BytesWarning: str() on a bytes instance

To resolve this I am proposing to read in the version as a string to avoid string to bytes comparisons

@jataylo jataylo marked this pull request as ready for review March 21, 2024 13:43
@jataylo jataylo requested a review from ptillet as a code owner March 21, 2024 13:43
@ptillet ptillet merged commit 2d80562 into triton-lang:main Mar 24, 2024
5 checks passed
jataylo added a commit to jataylo/triton that referenced this pull request Mar 28, 2024
…ang#3428)

Resolves an error observed as part of inductor support bring-up for AMD
when running unit test's via PyTorch's run_test.py due to the addition
of `-bb` flag in pytest which forbids string/bytes comparisons.
```
  File "/opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_inductor/triton_heuristics.py", line 208, in precompile
    compiled_binary, launcher = self._precompile_config(
  File "/opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_inductor/triton_heuristics.py", line 365, in _precompile_config
    binary = triton.compile(*compile_args, **compile_kwargs)
  File "/root/triton/python/triton/compiler/compiler.py", line 229, in compile
    key = f"{triton_key()}-{src.hash()}-{backend.hash()}-{options.hash()}-{str(sorted(get_env_vars().items()))}"
  File "/root/triton/python/triton/backends/amd/compiler.py", line 231, in hash
    return f'{version}-{self.target}'
BytesWarning: str() on a bytes instance
```
To resolve this I am proposing to read in the version as a string to
avoid string to bytes comparisons

(cherry picked from commit 2d80562)
karupayun pushed a commit to openxla/triton that referenced this pull request Apr 3, 2024
…ang#3428)

Resolves an error observed as part of inductor support bring-up for AMD
when running unit test's via PyTorch's run_test.py due to the addition
of `-bb` flag in pytest which forbids string/bytes comparisons.
```
  File "/opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_inductor/triton_heuristics.py", line 208, in precompile
    compiled_binary, launcher = self._precompile_config(
  File "/opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_inductor/triton_heuristics.py", line 365, in _precompile_config
    binary = triton.compile(*compile_args, **compile_kwargs)
  File "/root/triton/python/triton/compiler/compiler.py", line 229, in compile
    key = f"{triton_key()}-{src.hash()}-{backend.hash()}-{options.hash()}-{str(sorted(get_env_vars().items()))}"
  File "/root/triton/python/triton/backends/amd/compiler.py", line 231, in hash
    return f'{version}-{self.target}'
BytesWarning: str() on a bytes instance
```
To resolve this I am proposing to read in the version as a string to
avoid string to bytes comparisons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants