Skip to content

build: fix hash sub for out-of-tree builds #3115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

atkassen
Copy link
Contributor

@atkassen atkassen commented Apr 17, 2025

When building oneDNN outside of the git tree, but inside that of a different repository, the commit hash that is substituted is from the parent repository. This change limits git to the oneDNN root directory, and silences the error message when the git command fails.

For example:

git clone https://github.com/uxlfoundation/oneDNN.git dnnl
mkdir test_fail
git --git-dir dnnl/.git --work-tree test_fail checkout origin/main .
cmake -S test_fail -B test_fail/build
grep "#define DNNL_VERSION_HASH" test_fail/build/include/oneapi/dnnl/dnnl_version_hash.h

Before (out-of-tree):

-- CMAKE_BUILD_TYPE is unset, defaulting to Release
...
-- Found Git: /usr/bin/git (found version "2.30.2")
fatal: not a git repository (or any of the parent directories): .git
-- Enabled testing coverage: CI
...
-- Build files have been written to: test_fail/build
#define DNNL_VERSION_HASH  "N/A"

Before (within, say, the latest IGC at the time of writing):

-- CMAKE_BUILD_TYPE is unset, defaulting to Release
...
-- Found Git: /usr/bin/git (found version "2.30.2")
-- Enabled testing coverage: CI
...
-- Build files have been written to: test_fail/build
#define DNNL_VERSION_HASH  "8f182b27f4622f71af9f675d43c4944d6357b4b8"

After:

-- CMAKE_BUILD_TYPE is unset, defaulting to Release
...
-- Found Git: /usr/bin/git (found version "2.30.2")
-- Enabled testing coverage: CI
...
-- Build files have been written to: test_fail/build
#define DNNL_VERSION_HASH  "N/A"

@atkassen atkassen self-assigned this Apr 17, 2025
@atkassen atkassen requested a review from a team as a code owner April 17, 2025 17:17
When building oneDNN outside of the git tree, but inside that of a
different repository, the commit hash that is substituted is from the
parent repository. This change limits git to the oneDNN root directory,
and silences the error message when the git command fails.

For example:
```bash
git clone https://github.com/uxlfoundation/oneDNN.git dnnl
mkdir test_fail
git --git-dir dnnl/.git --work-tree test_fail checkout origin/main .
cmake -S test_fail -B test_fail/build
grep "#define DNNL_VERSION_HASH" test_fail/build/include/oneapi/dnnl/dnnl_version_hash.h
```
Before (out-of-tree):
```
-- CMAKE_BUILD_TYPE is unset, defaulting to Release
...
-- Found Git: /usr/bin/git (found version "2.30.2")
fatal: not a git repository (or any of the parent directories): .git
-- Enabled testing coverage: CI
...
-- Build files have been written to: test_fail/build
```
Before (within, say, the latest IGC at the time of writing):
```
-- CMAKE_BUILD_TYPE is unset, defaulting to Release
...
-- Found Git: /usr/bin/git (found version "2.30.2")
-- Enabled testing coverage: CI
...
-- Build files have been written to: test_fail/build
```
After:
```
-- CMAKE_BUILD_TYPE is unset, defaulting to Release
...
-- Found Git: /usr/bin/git (found version "2.30.2")
-- Enabled testing coverage: CI
...
-- Build files have been written to: test_fail/build
```
@atkassen atkassen force-pushed the akassen/silence-hash-sub-fail branch from 253e0c4 to fb2e68e Compare April 17, 2025 17:23
@atkassen
Copy link
Contributor Author

make test
disable test_device_cpu
disable benchdnn_all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants