Skip to content
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

[WIP] Revive checks #14

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
25 changes: 23 additions & 2 deletions .pfnci/config.pbtxt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
configs {
key: "sold.gpu",
key: "sold.ubuntu2004"
value {
requirement {
cpu: 8
Expand All @@ -14,6 +14,27 @@ configs {
time_limit: {
seconds: 3600
}
command: "bash .pfnci/run_gpu_test.sh"
environment_variables: { key: "OS" value: "ubuntu20.04" }
command: "bash .pfnci/run_gpu_test_all.sh"
}
}
configs {
key: "sold.ubuntu2204"
value {
requirement {
cpu: 8
memory: 32
disk: 50
gpu: 1
}
checkout_strategy {
ignore_gitignore: true
include_dot_git: true
}
time_limit: {
seconds: 3600
}
environment_variables: { key: "OS" value: "ubuntu22.04" }
command: "bash .pfnci/run_gpu_test_all.sh"
}
}
25 changes: 16 additions & 9 deletions .pfnci/run_gpu_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ LIBTORCH_VERSION=${LIBTORCH_VERSION:-1.13.0}
LIBTORCH_ARCH=${LIBTORCH_ARCH:-cu117}
OS=${OS:-ubuntu22.04}

cat >> test.sh <<'EOF'
cat > test.sh <<'EOF'
#!/bin/bash
set -eux

nvidia-smi

export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get install -y \
python3 \
python3-pip \
cmake \
clang-format \
rsync \
git \
Expand All @@ -26,17 +26,24 @@ apt-get update && apt-get install -y \
wget \
unzip

# Default cmake version in Ubuntu22.04
pip3 install cmake==3.22.1
pip3 install pytest numpy cmake-format
./run-format.sh
./download-libtorch.sh

rm -rf build
mkdir build
cd build

../download-libtorch.sh
LIBTORCH_DIR=$(pwd)/pytorch-install/libtorch

mkdir build && cd build && \
cmake .. \
-GNinja \
-DSOLD_PYBIND_TEST=ON \
-DSOLD_LIBTORCH_TEST=ON \
-DCMAKE_PREFIX_PATH=${LIBTORCH_DIR}/share/cmake/Torch/
cmake .. \
-GNinja \
-DSOLD_PYBIND_TEST=ON \
-DSOLD_LIBTORCH_TEST=ON \
-DCMAKE_PREFIX_PATH=${LIBTORCH_DIR}/share/cmake/Torch/

ninja

ctest --output-on-failure
Expand Down
9 changes: 9 additions & 0 deletions .pfnci/run_gpu_test_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -eux

for LIBTORCH in cu113/1.12.1 cu117/1.13.0; do
IFS=/ read -r LIBTORCH_ARCH LIBTORCH_VERSION <<< $LIBTORCH
LIBTORCH_VERSION=$LIBTORCH_VERSION \
LIBTORCH_ARCH=$LIBTORCH_ARCH \
bash .pfnci/run_gpu_test.sh
done
4 changes: 2 additions & 2 deletions download-libtorch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ LIBTORCH_ZIP_SUFFIX="%2B${LIBTORCH_ARCH}"

URL="https://download.pytorch.org/libtorch${LIBTORCH_RELEASE_TYPE}/${LIBTORCH_ARCH}/libtorch${LIBTORCH_ABI}${LIBTORCH_OSNAME}${LIBTORCH_LIBOPT}-${LIBTORCH_VERSION}${LIBTORCH_ZIP_SUFFIX}.zip"

wget -O libtorch.zip "${URL}"
unzip libtorch.zip -d pytorch-install
wget -q -O libtorch.zip "${URL}"
unzip -q libtorch.zip -d pytorch-install
3 changes: 1 addition & 2 deletions elf_binary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ std::pair<std::string, std::string> ELFBinary::GetVersion(int index, const std::
return std::make_pair(found->second, std::string(strtab_ + vna->vna_name));
} else {
std::string s = ShowStdMap(filename_to_soname);
// TODO (akawashiro): Revive this assertion
// LOG(FATAL) << "There is no entry for " << filename << " in filename_to_soname=" << s << ".";
LOG(FATAL) << "There is no entry for " << filename << " in filename_to_soname=" << s << ".";
}
}

Expand Down
9 changes: 8 additions & 1 deletion symtab_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,20 @@ bool SymtabBuilder::Resolve(const std::string& name, const std::string& soname,
if (found != src_syms_.end()) {
versym = found->second.first;
symp = found->second.second;
} else {
} else if (!soname.empty() && !version.empty()) {
auto found_fallback = src_fallback_syms_.find(name);
if (found_fallback != src_fallback_syms_.end()) {
LOG(INFO) << "Use fallback version of " << name;
versym = found_fallback->second.first;
symp = found_fallback->second.second;
}
} else {
auto found_fallback = src_fallback_syms_.find(name);
if (found_fallback != src_fallback_syms_.end()) {
LOG(INFO) << "Use NO_VERSION_INFO for " << name;
versym = NO_VERSION_INFO;
symp = found_fallback->second.second;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ std::ostream& operator<<(std::ostream& os, const Elf_Rel& r) {
}

bool is_special_ver_ndx(Elf64_Versym versym) {
return (versym == VER_NDX_LOCAL || versym == VER_NDX_GLOBAL);
return (versym == VER_NDX_LOCAL || versym == VER_NDX_GLOBAL || versym == NO_VERSION_INFO);
}

std::string special_ver_ndx_to_str(Elf64_Versym versym) {
Expand Down
10 changes: 4 additions & 6 deletions version_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ void VersionBuilder::Add(Elf_Versym versym, const std::string& soname, const std

vers.push_back(versym);
} else {
// TODO (akawashiro): Revive this assertion
// CHECK(!soname.empty() && !version.empty()) << SOLD_LOG_KEY(soname) << SOLD_LOG_KEY(version) << SOLD_LOG_KEY(versym);
CHECK(!soname.empty() && !version.empty()) << SOLD_LOG_KEY(soname) << SOLD_LOG_KEY(version) << SOLD_LOG_KEY(versym);

auto found_filename = soname_to_filename_.find(soname);
// TODO (akawashiro): Revive this assertion
// CHECK(found_filename != soname_to_filename_.end())
// << soname << " does not exists in soname_to_filename." << SOLD_LOG_KEY(soname) << SOLD_LOG_KEY(version);
std::string filename = found_filename != soname_to_filename_.end() ? found_filename->second : "";
CHECK(found_filename != soname_to_filename_.end())
<< soname << " does not exists in soname_to_filename." << SOLD_LOG_KEY(soname) << SOLD_LOG_KEY(version);
std::string filename = found_filename->second;

strtab.Add(filename);
strtab.Add(version);
Expand Down