Fix SHA calculation and checkout (#11339)

diff --git a/.github/workflows/run_mmperf.yml b/.github/workflows/run_mmperf.yml
index f9c8e41..d488b11 100644
--- a/.github/workflows/run_mmperf.yml
+++ b/.github/workflows/run_mmperf.yml
@@ -30,8 +30,8 @@
       BASE_REF: HEAD^
       PR_TITLE: ${{ github.event.pull_request.title }}
       PR_BODY: ${{ github.event.pull_request.body }}
+      IREE_SHA: ${{ github.sha }}
     outputs:
-      iree-sha: ${{ steps.iree.outputs.iree-sha }}
       artifact-upload-dir: ${{ steps.iree.outputs.artifact-upload-dir }}
       should-run: ${{ steps.configure.outputs.should-run }}
       runner-env: ${{ steps.configure.outputs.runner-env }}
@@ -54,8 +54,6 @@
       - name: "Calculating version info"
         id: iree
         run: |
-          IREE_SHA=`git rev-parse HEAD`
-          echo "iree-sha=${IREE_SHA}" >> $GITHUB_OUTPUT
           export GCS_ARTIFACT_DIR="$(date +'%Y-%m-%d').sha_${IREE_SHA}.timestamp_$(date +'%s')"
           echo "artifact-upload-dir=${GCS_ARTIFACT_DIR}" >> $GITHUB_OUTPUT
 
@@ -69,7 +67,7 @@
       - cpu
       - os-family=Linux
     env:
-      IREE_SHA: ${{ needs.setup.outputs.iree-sha }}
+      IREE_SHA: ${{ github.sha }}
       BUILD_DIR: mmperf-build-cpu
       RESULTS_DIR: mmperf-results-cpu
       GCS_UPLOAD_PARENT_DIR: "gs://mmperf-benchmark-artifacts/cpu"
@@ -103,7 +101,7 @@
       - cpu
       - os-family=Linux
     env:
-      IREE_SHA: ${{ needs.setup.outputs.iree-sha }}
+      IREE_SHA: ${{ github.sha }}
       BUILD_DIR: mmperf-build-cuda
     outputs:
       build-dir: ${{ env.BUILD_DIR }}
diff --git a/build_tools/benchmarks/mmperf/build_mmperf.sh b/build_tools/benchmarks/mmperf/build_mmperf.sh
index cdf8c6b..93d976e 100755
--- a/build_tools/benchmarks/mmperf/build_mmperf.sh
+++ b/build_tools/benchmarks/mmperf/build_mmperf.sh
@@ -46,6 +46,7 @@
 # Update IREE.
 pushd external/iree
 git fetch https://github.com/iree-org/iree "${IREE_SHA}"
+git checkout "${IREE_SHA}"
 git submodule update --init --jobs 8 --depth 1
 popd # external/iree