Skip to content

feat(rocm): Add Windows support to ROCm backend#8

Closed
antmikinka wants to merge 0 commit into
NripeshN:rocm-supportfrom
antmikinka:rocm-support
Closed

feat(rocm): Add Windows support to ROCm backend#8
antmikinka wants to merge 0 commit into
NripeshN:rocm-supportfrom
antmikinka:rocm-support

Conversation

@antmikinka
Copy link
Copy Markdown

Summary

This PR updates the rocm-support branch with full Windows compatibility for the ROCm/HIP backend. The original ROCm backend was developed for Linux; this PR adapts it to work with ROCm 7.1 on Windows 11.

Changes Made

CMake Build System

  • Root CMakeLists.txt: Added Windows ROCm installation paths (C:/Program Files/AMD/ROCm/7.1/bin) and environment variable hints (ROCM_PATH, ROCM_HOME) for HIP compiler discovery
  • mlx/backend/rocm/CMakeLists.txt:
    • Guarded GCC/Linux-specific include path discovery with if(NOT WIN32)
    • Added Windows ROCm include directory fallback paths
    • Platform-specific object file extensions (.obj on Windows, .o on Linux)
    • Removed -fPIC on Windows (not needed for DLLs)
    • Guarded -parallel-jobs clang-specific flag on Windows
    • Platform-specific static library naming (.lib on Windows, .a on Linux)
    • Platform-specific archiver command (/OUT: for MSVC, rcs for Unix)
    • Unified ROCm library search paths with Windows defaults

Source Code

  • allocator.cpp:
    • Made #include <unistd.h> conditional on #ifndef _WIN32
    • Implemented cross_platform_clzll() using _BitScanReverse64 on MSVC and __builtin_clzll elsewhere
  • jit_module.cpp:
    • Replaced POSIX stderr suppressor with Windows equivalent (_dup/_dup2/_open("nul"))
    • Added Windows ROCm path detection via ProgramFiles env var and multiple version fallbacks

Test Infrastructure

  • rocm_skip.py: Added skip entries for Metal-specific kernel tests (test_export_import_custom_kernel, test_custom_kernel_caching)
  • Merged latest main (31 commits) including critical Windows JIT compiler support (5d1c0e4c)

Commits

  1. 16c411f8 — Merge origin/main into rocm-support
  2. 36f37be3 — feat(rocm): Add Windows support to CMake build files
  3. 3da1e3f2 — feat(rocm): Add Windows support to ROCm backend source files
  4. 3239866e — fix(rocm): Address quality review findings for Windows build
  5. 2adb9d93 — fix(rocm): Add ROCm skip entries for Metal-specific kernel tests

Environment

  • ROCm 7.1 (HIP 7.1.51803) on Windows 11 Pro
  • Installed at C:\Program Files\AMD\ROCm\7.1\

Notes

  • This PR targets the rocm-support branch, not main
  • Build validation on ROCm hardware still needed
  • 69 tests are skipped on ROCm via rocm_skip.py (FFT, LAPACK, complex types, Metal-specific tests)

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.

1 participant