@@ -103,12 +103,12 @@ jobs:
103103        key : llvm-${{ needs.constants.outputs.llvm_version }}-container-source 
104104        enableCrossOsArchive : True 
105105
106-     - name : Cache MHLO  Source 
107-       id : cache-mhlo -source 
106+     - name : Cache Stablehlo  Source 
107+       id : cache-stablehlo -source 
108108      uses : actions/cache@v4 
109109      with :
110-         path : ${{ github.workspace }}/mlir/mlir-hlo  
111-         key : mhlo -${{ needs.constants.outputs.mhlo_version  }}-container-source
110+         path : ${{ github.workspace }}/mlir/stablehlo  
111+         key : stablehlo -${{ needs.constants.outputs.stablehlo_version  }}-container-source
112112        enableCrossOsArchive : True 
113113
114114    - name : Cache Enzyme Source 
@@ -128,25 +128,18 @@ jobs:
128128        path : ${{ github.workspace }}/mlir/llvm-project 
129129
130130    - name : Patch LLVM Source 
131-       if : steps.cache-mhlo -source.outputs.cache-hit != 'true' 
131+       if : steps.cache-llvm -source.outputs.cache-hit != 'true' 
132132      run : | 
133133        cd $GITHUB_WORKSPACE/mlir/llvm-project 
134134        git apply $GITHUB_WORKSPACE/mlir/patches/llvm-bufferization-segfault.patch 
135135
136- name : Clone MHLO  Submodule 
137-       if : steps.cache-mhlo -source.outputs.cache-hit != 'true' 
136+ name : Clone Stablehlo  Submodule 
137+       if : steps.cache-stablehlo -source.outputs.cache-hit != 'true' 
138138      uses : actions/checkout@v4 
139139      with :
140-         repository : tensorflow/mlir-hlo 
141-         ref : ${{ needs.constants.outputs.mhlo_version }} 
142-         path : ${{ github.workspace }}/mlir/mlir-hlo 
143- 
144-     - name : Patch MHLO Source 
145-       if : steps.cache-mhlo-source.outputs.cache-hit != 'true' 
146-       run : | 
147-         cd $GITHUB_WORKSPACE/mlir/mlir-hlo 
148-         git apply $GITHUB_WORKSPACE/mlir/patches/mhlo-remove-shardy.patch 
149-         git apply $GITHUB_WORKSPACE/mlir/patches/mhlo-rename-sort.patch 
140+         repository : openxla/stablehlo 
141+         ref : ${{ needs.constants.outputs.stablehlo_version }} 
142+         path : ${{ github.workspace }}/mlir/stablehlo 
150143
151144    - name : Clone Enzyme Submodule 
152145      if : steps.cache-enzyme-source.outputs.cache-hit != 'true' 
@@ -170,12 +163,12 @@ jobs:
170163        path : ${{ github.workspace }}/llvm-build 
171164        key : ${{ matrix.container_img }}-llvm-${{ needs.constants.outputs.llvm_version }}-${{ matrix.python_version }}-wheel-build 
172165
173-     - name : Check MHLO  Build Cache 
174-       id : cache-mhlo -build 
166+     - name : Check Stablehlo  Build Cache 
167+       id : cache-stablehlo -build 
175168      uses : actions/cache/restore@v4 
176169      with :
177-         path : ${{ github.workspace }}/mhlo -build 
178-         key : ${{ matrix.container_img }}-mhlo -${{ needs.constants.outputs.mhlo_version  }}-wheel-build 
170+         path : ${{ github.workspace }}/stablehlo -build 
171+         key : ${{ matrix.container_img }}-stablehlo -${{ needs.constants.outputs.stablehlo_version  }}-wheel-build 
179172        lookup-only : True 
180173
181174    - name : Check Enzyme Build Cache 
@@ -189,7 +182,7 @@ jobs:
189182    - name : Install dependencies (AlmaLinux) 
190183      if : | 
191184        steps.cache-llvm-build.outputs.cache-hit != 'true' || 
192-         steps.cache-mhlo -build.outputs.cache-hit != 'true' || 
185+         steps.cache-stablehlo -build.outputs.cache-hit != 'true' || 
193186        steps.cache-enzyme-build.outputs.cache-hit != 'true' 
194187run : | 
195188        # Reduce wait time for repos not responding 
@@ -205,7 +198,6 @@ jobs:
205198        PYTHON_BINS=$(find /opt/_internal/cpython-${{ matrix.python_version }}.*/bin -maxdepth 1 -type d | tr '\n' ':' | sed 's/:$//') 
206199        echo $PYTHON_BINS >> $GITHUB_PATH 
207200
208- #  LLD is required for MHLO builds.
209201#  (Don't forget to add the build directory to PATH in subsequent steps, so
210202    #  other tools can find it, in particular collect2 invoked by gcc.)
211203    - name : Build LLVM / MLIR 
@@ -230,31 +222,24 @@ jobs:
230222        path : ${{ github.workspace }}/llvm-build 
231223        key : ${{ matrix.container_img }}-llvm-${{ needs.constants.outputs.llvm_version }}-${{matrix.python_version}}-wheel-build 
232224
233-     - name : Build MHLO Dialect 
234-       if : steps.cache-mhlo-build.outputs.cache-hit != 'true' 
235-       #  building with LLD is a strong requirement for mhlo
225+     - name : Build Stablehlo Dialect 
226+       if : steps.cache-stablehlo-build.outputs.cache-hit != 'true' 
236227      run : | 
237-         export PATH=$GITHUB_WORKSPACE/llvm-build/bin:$PATH 
238- 
239-         cmake -S mlir/mlir-hlo -B $GITHUB_WORKSPACE/mhlo-build -G Ninja \ 
240-               -DCMAKE_BUILD_TYPE=Release \ 
241-               -DLLVM_ENABLE_ASSERTIONS=ON \ 
242-               -DMLIR_DIR="$GITHUB_WORKSPACE/llvm-build/lib/cmake/mlir" \ 
243-               -DPython3_EXECUTABLE=$(which python${{ matrix.python_version }}) \ 
244-               -DLLVM_ENABLE_ZLIB=FORCE_ON \ 
245-               -DLLVM_ENABLE_ZSTD=OFF \ 
246-               -DCMAKE_CXX_VISIBILITY_PRESET=default \ 
247-               -DLLVM_ENABLE_LLD=ON 
248- 
249-         LIT_FILTER_OUT="chlo_legalize_to_mhlo" cmake --build $GITHUB_WORKSPACE/mhlo-build --target check-mlir-hlo 
228+         C_COMPILER=$(which gcc) \ 
229+         CXX_COMPILER=$(which g++) \ 
230+         LLVM_BUILD_DIR="$(pwd)/llvm-build" \ 
231+         STABLEHLO_BUILD_DIR="$GITHUB_WORKSPACE/stablehlo-build" \ 
232+         COMPILER_LAUNCHER="" \ 
233+         ENABLE_LLD=OFF \ 
234+         make stablehlo 
250235
251- name : Save MHLO  Build 
252-       id : save-mhlo -build 
253-       if : steps.cache-mhlo -build.outputs.cache-hit != 'true' 
236+ name : Save Stablehlo  Build 
237+       id : save-stablehlo -build 
238+       if : steps.cache-stablehlo -build.outputs.cache-hit != 'true' 
254239      uses : actions/cache/save@v4 
255240      with :
256-         path : ${{ github.workspace }}/mhlo -build 
257-         key : ${{ matrix.container_img }}-mhlo -${{ needs.constants.outputs.mhlo_version  }}-wheel-build 
241+         path : ${{ github.workspace }}/stablehlo -build 
242+         key : ${{ matrix.container_img }}-stablehlo -${{ needs.constants.outputs.stablehlo_version  }}-wheel-build 
258243
259244    - name : Build Enzyme 
260245      if : steps.cache-enzyme-build.outputs.cache-hit != 'true' 
@@ -328,21 +313,21 @@ jobs:
328313        key : ${{ matrix.container_img }}-llvm-${{ needs.constants.outputs.llvm_version }}-3.11-wheel-build 
329314        fail-on-cache-miss : True 
330315
331-     - name : Get Cached MHLO  Source 
332-       id : cache-mhlo -source 
316+     - name : Get Cached Stablehlo  Source 
317+       id : cache-stablehlo -source 
333318      uses : actions/cache/restore@v4 
334319      with :
335-         path : ${{ github.workspace }}/mlir/mlir-hlo  
336-         key : mhlo -${{ needs.constants.outputs.mhlo_version  }}-container-source
320+         path : ${{ github.workspace }}/mlir/stablehlo  
321+         key : stablehlo -${{ needs.constants.outputs.stablehlo_version  }}-container-source
337322        enableCrossOsArchive : True 
338323        fail-on-cache-miss : True 
339324
340-     - name : Get Cached MHLO  Build 
341-       id : cache-mhlo -build 
325+     - name : Get Cached Stablehlo  Build 
326+       id : cache-stablehlo -build 
342327      uses : actions/cache/restore@v4 
343328      with :
344-         path : ${{ github.workspace }}/mhlo -build 
345-         key : ${{ matrix.container_img }}-mhlo -${{ needs.constants.outputs.mhlo_version  }}-wheel-build 
329+         path : ${{ github.workspace }}/stablehlo -build 
330+         key : ${{ matrix.container_img }}-stablehlo -${{ needs.constants.outputs.stablehlo_version  }}-wheel-build 
346331        fail-on-cache-miss : True 
347332
348333    - name : Get Cached Enzyme Source 
@@ -397,8 +382,8 @@ jobs:
397382              -DPython3_EXECUTABLE=$(which python${{ matrix.python_version }}) \ 
398383              -DPython3_NumPy_INCLUDE_DIRS=$(python${{ matrix.python_version }} -c "import numpy as np; print(np.get_include())") \ 
399384              -DMLIR_DIR="$GITHUB_WORKSPACE/llvm-build/lib/cmake/mlir" \ 
400-               -DMHLO_DIR ="$GITHUB_WORKSPACE/mhlo-build/lib/cmake/ mlir-hlo " \ 
401-               -DMHLO_BINARY_DIR ="$GITHUB_WORKSPACE/mhlo -build/bin " \ 
385+               -DSTABLEHLO_DIR ="$GITHUB_WORKSPACE/mlir/stablehlo " \ 
386+               -DSTABLEHLO_BUILD_DIR ="$GITHUB_WORKSPACE/stablehlo -build" \ 
402387              -DEnzyme_DIR="$GITHUB_WORKSPACE/enzyme-build" \ 
403388              -DENZYME_SRC_DIR="$GITHUB_WORKSPACE/mlir/Enzyme" \ 
404389              -DLLVM_ENABLE_ZLIB=FORCE_ON \ 
@@ -421,7 +406,7 @@ jobs:
421406      run : | 
422407        PYTHON=python${{ matrix.python_version }} \ 
423408        LLVM_BUILD_DIR="$GITHUB_WORKSPACE/llvm-build" \ 
424-         MHLO_BUILD_DIR ="$GITHUB_WORKSPACE/mhlo -build" \ 
409+         STABLEHLO_BUILD_DIR ="$GITHUB_WORKSPACE/stablehlo -build" \ 
425410        DIALECTS_BUILD_DIR="$GITHUB_WORKSPACE/quantum-build" \ 
426411        RT_BUILD_DIR="$GITHUB_WORKSPACE/runtime-build" \ 
427412        OQC_BUILD_DIR="$GITHUB_WORKSPACE/oqc-build" \ 
0 commit comments