diff --git a/.github/actions/load/action.yml b/.github/actions/load/action.yml index a1d205fb18..f3134a2a02 100644 --- a/.github/actions/load/action.yml +++ b/.github/actions/load/action.yml @@ -2,7 +2,7 @@ name: load description: Load a directory from a cache based on a shared directory inputs: root: - description: + description: Directory for cache default: /cache path: description: A directory to load from a cache @@ -12,8 +12,10 @@ inputs: required: true symlink: description: Create a symlink instead of copying from cache - type: bool - default: true + default: "true" + enabled: + description: Enable cache + default: "true" outputs: path: description: A directory to save to a cache @@ -24,6 +26,7 @@ outputs: dest: description: Directory in cache value: ${{ steps.load.outputs.dest }} + runs: using: "composite" steps: @@ -37,7 +40,7 @@ runs: echo "Directory ${{ inputs.path }} exists and will not be restored from cache" exit 1 fi - if [[ -d $ITEM_PATH ]]; then + if [[ ${{ inputs.enabled == 'true' }} && -d $ITEM_PATH ]]; then echo "Cache hit for ${{ inputs.key }}" echo "status=hit" >> $GITHUB_OUTPUT if [[ ${{ inputs.symlink }} == true ]]; then diff --git a/.github/actions/save/action.yml b/.github/actions/save/action.yml index 6ee34dfee9..b46d985c62 100644 --- a/.github/actions/save/action.yml +++ b/.github/actions/save/action.yml @@ -2,7 +2,7 @@ name: save description: Save a directory to a cache based on a shared directory inputs: root: - description: + description: Directory for cache default: /cache path: description: Directory to save to a cache @@ -10,12 +10,18 @@ inputs: dest: description: Directory in cache required: true + enabled: + description: Enable cache + default: "true" runs: using: "composite" steps: - name: Save ${{ inputs.path }} to cache shell: bash run: | + if [[ ${{ inputs.enabled != 'true' }} ]]; then + exit 0 + fi TEMP_ITEM=$(mktemp -d -p ${{ inputs.root }}) cp -rT ${{ inputs.path }} $TEMP_ITEM # ignore error if other job created a cache with the same key already diff --git a/.github/actions/setup-pytorch/action.yml b/.github/actions/setup-pytorch/action.yml index 17153cfc0e..f75edde9fb 100644 --- a/.github/actions/setup-pytorch/action.yml +++ b/.github/actions/setup-pytorch/action.yml @@ -19,6 +19,9 @@ inputs: mode: description: Source or wheels default: source + cache: + description: Cache enabled or disabled + default: enabled runs: using: "composite" steps: @@ -88,6 +91,7 @@ runs: with: path: pytorch key: pytorch-$PYTORCH_CACHE_KEY-$CACHE_NUMBER + enabled: ${{ inputs.cache == 'enabled' }} - name: Clone PyTorch repository if: ${{ steps.pytorch-cache.outputs.status == 'miss' }} @@ -150,3 +154,4 @@ runs: with: path: ${{ steps.pytorch-cache.outputs.path }} dest: ${{ steps.pytorch-cache.outputs.dest }} + enabled: ${{ inputs.cache == 'enabled' }} diff --git a/.github/workflows/inductor-tests-reusable.yml b/.github/workflows/inductor-tests-reusable.yml index 554cc7ed9f..9618367c0f 100644 --- a/.github/workflows/inductor-tests-reusable.yml +++ b/.github/workflows/inductor-tests-reusable.yml @@ -59,6 +59,7 @@ jobs: with: repository: ${{ env.PYTORCH_REPO}} ref: ${{ inputs.pytorch_ref }} + cache: disabled - name: Setup Triton uses: ./.github/actions/setup-triton