[ROCm][Windows] Enable torchvision build with ROCm on Windows (#147382)

- Updated HIP flags for Windows (removed non Windows flags on Windows case, added runtime library)
- Set hipcc call for Windows case
- Removed CUDA flags (not used in ROCm) on Windows
- Updated Windows compiler (added case when using ROCm on Windows)
- Fixed path issue in hipify_python

Pull Request resolved: https://github.com/pytorch/pytorch/pull/147382
Approved by: https://github.com/jeffdaily

Co-authored-by: Jeff Daily <jeff.daily@amd.com>
This commit is contained in:
tvukovic-amd
2025-03-18 23:37:01 +00:00
committed by PyTorch MergeBot
parent 61a64c20c4
commit 268de64005
2 changed files with 67 additions and 26 deletions

View File

@ -139,7 +139,6 @@ class GeneratedFileCleaner:
for d in self.dirs_to_clean[::-1]:
os.rmdir(d)
# Follow UNIX convention for paths to use '/' instead of '\\' on Windows
def _to_unix_path(path: str) -> str:
return path.replace(os.sep, '/')
@ -830,6 +829,7 @@ def preprocessor(
show_progress: bool) -> HipifyResult:
""" Executes the CUDA -> HIP conversion on the specified file. """
fin_path = os.path.abspath(os.path.join(output_directory, filepath))
filepath = _to_unix_path(filepath)
hipify_result = HIPIFY_FINAL_RESULT[fin_path]
if filepath not in all_files:
hipify_result.hipified_path = None
@ -932,8 +932,8 @@ def preprocessor(
return templ.format(os.path.relpath(header_fout_path if header_fout_path is not None
else header_filepath, header_dir))
hipified_header_filepath = HIPIFY_FINAL_RESULT[header_filepath].hipified_path
return templ.format(os.path.relpath(hipified_header_filepath if hipified_header_filepath is not None
else header_filepath, header_dir))
return templ.format(_to_unix_path(os.path.relpath(hipified_header_filepath if hipified_header_filepath is not None
else header_filepath, header_dir)))
return m.group(0)
return repl