Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 36 additions & 9 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,11 @@ jobs:
env:
# SCCACHE_GHA_ENABLED: "on"
ROCM_PATH: "/opt/rocm"
RANDOMIZE_READDIR_LOG: "/tmp/readdir.log"

steps:
- uses: actions/checkout@v4
- name: Clone repository
uses: actions/checkout@v4

# I don't want to break the cache during testing. Will turn on after I
# make sure it's working.
Expand All @@ -606,44 +608,69 @@ jobs:
# script: |
# core.exportVariable('ROCM_PATH', process.env.ROCM_PATH || '');

- name: Install dependencies
shell: bash
run: |
## Install dependencies
sudo apt-get update
sudo apt-get install -y cmake curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Install rust
uses: ./.github/actions/rust-toolchain
with:
toolchain: "stable"

- name: Build & setup librandomize_readdir
run: |
cargo build -p randomize_readdir

- uses: actions/download-artifact@v4
with:
name: integration-tests
path: /home/runner/.cargo/bin/
- name: Chmod for binary
run: chmod +x ${SCCACHE_PATH}

- name: Install dependencies
shell: bash
run: |
## Install dependencies
sudo apt-get update
sudo apt-get install -y cmake

# Ensure that HIPCC isn't already borken
- name: Sanity Check
run: |
export LD_PRELOAD=$PWD/target/debug/librandomize_readdir.so
hipcc -o vectoradd_hip --offload-arch=gfx900 tests/cmake-hip/vectoradd_hip.cpp

- name: Test
run: |
export LD_PRELOAD=$PWD/target/debug/librandomize_readdir.so
rm "$RANDOMIZE_READDIR_LOG".*
cmake -B build -S tests/cmake-hip -DCMAKE_HIP_COMPILER_LAUNCHER=${SCCACHE_PATH} -DCMAKE_HIP_ARCHITECTURES=gfx900
cmake --build build
if ! grep -q bitcode "$RANDOMIZE_READDIR_LOG".*; then
echo "amdgcn bitcode not accessed, is librandomize_readdir properly set up?"
exit 1
fi

- name: Output
run: |
export LD_PRELOAD=$PWD/target/debug/librandomize_readdir.so
${SCCACHE_PATH} --show-stats

- name: Test Twice for Cache Read
run: |
export LD_PRELOAD=$PWD/target/debug/librandomize_readdir.so
rm "$RANDOMIZE_READDIR_LOG".*
rm -rf build
cmake -B build -S tests/cmake-hip -DCMAKE_HIP_COMPILER_LAUNCHER=${SCCACHE_PATH} -DCMAKE_HIP_ARCHITECTURES=gfx900
cmake --build build
if ! grep -q bitcode "$RANDOMIZE_READDIR_LOG".*; then
echo "amdgcn bitcode not accessed, is librandomize_readdir properly set up?"
exit 1
fi

- name: Output
run: |
export LD_PRELOAD=$PWD/target/debug/librandomize_readdir.so
${SCCACHE_PATH} --show-stats

${SCCACHE_PATH} --show-stats | grep -e "Cache hits\s*[1-9]"

gcc:
Expand Down
33 changes: 33 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,4 @@ dist-tests = ["dist-client", "dist-server"]

[workspace]
exclude = ["tests/test-crate"]
members = ["tests/randomize_readdir"]
7 changes: 5 additions & 2 deletions src/compiler/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,13 @@ where
.read_dir()
.ok()
.map(|f| {
f.flatten()
let mut device_libs = f
.flatten()
.filter(|f| f.path().extension().is_some_and(|ext| ext == "bc"))
.map(|f| f.path())
.collect()
.collect::<Vec<_>>();
device_libs.sort_unstable();
device_libs
})
.unwrap_or_default()
}
Expand Down
15 changes: 15 additions & 0 deletions tests/randomize_readdir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
edition = "2021"
name = "randomize_readdir"
version = "0.1.0"

[dependencies]
ctor = "0.2"
libc = "0.2.99"
log = "0.4"
once_cell = "1"
rand = "0.8"
simplelog = "0.12"

[lib]
crate-type = ["cdylib"]
Loading
Loading