I am trying to setup torch-mlir
repository on my personal server. This repository has two submodules, llvm-project
and mlir-hlo
.
Now, on my server, I already have llvm-project
and mlir-hlo
. However, I am unable to replace the links for these submodules in the torch-mlir
project.
torch-mlir
locally.gitmodule
filegit submodule deinit
externals/llvm-project
and externals/mlir-hlo
and executed the following commands respectively:
git remote set-url origin <my server path to llvm-project>
git remote set-url origin <my server path to mlir-hlo>
git submodule sync
git submodule update --init --recursive
I am receiving the following error:
fatal: remote error: upload-pack: not our ref <aHash>
fatal: the remote end hung up unexpectedly
Fetched in submodule path 'externals/mlir-hlo', but it did not contain <aHash>. Direct fetching of that commit failed.
This commit hash does not even exist in the original github.com repo for mlir-hlo.
What is the correct way of replacing the submodules so that it works?
I ended up doing the following (resulted in a successful setup and build):
I moved under the torch-mlir
directory and executed the following steps.
Check the current status of sub-modules:
git submodule status
We wish to remove these, since they are linked to the github.com links:
git rm -r --cached externals/mlir-hlo
git rm -r --cached externals/llvm-project
rm -rf externals/llvm-project; rm -rf externals/mlir-hlo;
This will remove the submodules and their cached indices.
First, update the link to submodule repositories:
nano .gitmodules
Now, ensure the links are thoroughly updated:
git submodule add --force <your server path to mlir-hlo>.git externals/mlir-hlo
git submodule add --force <your server path to llvm-project>.git externals/llvm-project
The above commands will download the repositories and place them in the submodule's respective path.
For each submodule, select the particular branch (on your server's repo):
git submodule set-branch --branch main externals/mlir-hlo
git submodule set-branch --branch release/16.x externals/llvm-project
Ensure all submodules are synced up:
git submodule update --init --recursive
After this, we can go ahead and build the torch-mlir
project as per the documentation for that project.