Merge branch 'vortexgpgpu:master' into apptainer

This commit is contained in:
rahul7rajdn 2025-05-07 22:28:08 -04:00 committed by GitHub
commit fdd6ff7a63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 94 additions and 1 deletions

View file

@ -117,7 +117,7 @@ jobs:
strategy:
fail-fast: false
matrix:
name: [regression, opencl, cache, config1, config2, debug, scope, stress, synthesis, vm, vector]
name: [regression, opencl, cache, config1, config2, debug, scope, stress, synthesis, vm, vector, cupbop]
xlen: [32, 64]
steps:

View file

@ -403,6 +403,48 @@ vector()
echo "vector tests done!"
}
cupbop() {
echo "begin cupbop tests..."
if [ "$XLEN" == "32" ]; then
echo "cupbop tests skipped for 32-bit"
return
fi
echo "downloading cupbop binaries..."
CUPBOP_URL="https://www.dropbox.com/scl/fi/qxiofb0ejfxoog9m7tmae/cupbop.zip?rlkey=kcboy03c08xcn6yizd4nv8h88&st=7yuqftef&dl=1"
wget -O cupbop.zip "${CUPBOP_URL}" || curl -L -o cupbop.zip "${CUPBOP_URL}"
unzip -o cupbop.zip -d tests/
rm cupbop.zip
echo "building simx runtime..."
make -C runtime/simx
PERF_CLASS=2
VORTEX_RUNTIME_DIR="runtime"
CUPBOP_RUNTIME_DIR="tests/cupbop/runtime"
tests=("bfs" "nn")
tests_args=("./graph20.txt" "./filelist.txt -r 10 -lat 30 -lng 90")
for i in "${!tests[@]}"; do
test="${tests[$i]}"
args="${tests_args[$i]}"
echo "running test: $test"
(
cd "tests/cupbop/$test" || exit
chmod +x "./host_${XLEN}.out"
LD_LIBRARY_PATH="../../../${CUPBOP_RUNTIME_DIR}:../../../${VORTEX_RUNTIME_DIR}/simx:../../../${VORTEX_RUNTIME_DIR}:${LD_LIBRARY_PATH}" \
./host_${XLEN}.out ${args}
)
done
echo "cupbop tests done!"
}
show_usage()
{
echo "Vortex Regression Test"
@ -459,6 +501,9 @@ while [ "$1" != "" ]; do
--vector )
tests+=("vector")
;;
--cupbop )
tests+=("cupbop")
;;
--all )
tests=()
tests+=("unittest")
@ -475,6 +520,7 @@ while [ "$1" != "" ]; do
tests+=("stress")
tests+=("synthesis")
tests+=("vector")
tests+=("cupbop")
;;
-h | --help )
show_usage

View file

@ -12,6 +12,8 @@
// limitations under the License.
#include "util.h"
#include <fstream>
#include <sstream>
#include <string.h>
// return file extension
@ -36,4 +38,21 @@ void aligned_free(void *ptr) {
// retreive the stored unaligned address and use it to free the allocation
void* unaligned_addr = ((void**)ptr)[-1];
free(unaligned_addr);
}
std::string vortex::resolve_file_path(const std::string& filename, const std::string& searchPaths) {
std::ifstream ifs(filename);
if (!ifs) {
std::stringstream ss(searchPaths);
std::string path;
while (std::getline(ss, path, ',')) {
if (!path.empty()) {
std::string filePath = path + "/" + filename;
std::ifstream ifs(filePath);
if (ifs)
return filePath;
}
}
}
return filename;
}

View file

@ -17,6 +17,7 @@
#include <algorithm>
#include <assert.h>
#include <bitmanip.h>
#include <string>
template <typename... Args>
void unused(Args&&...) {}
@ -94,4 +95,6 @@ public:
}
};
std::string resolve_file_path(const std::string& filename, const std::string& searchPaths);
}

View file

@ -5,6 +5,14 @@
// Parallel Selection sort
struct key_t {
uint32_t user = 0;
};
static __attribute__((noinline)) void hacker(key_t* key, uint32_t task_id) {
key->user = task_id;
}
void kernel_body(kernel_arg_t* __UNIFORM__ arg) {
int32_t* src_ptr = (int32_t*)arg->src_addr;
int32_t* dst_ptr = (int32_t*)arg->dst_addr;
@ -13,6 +21,15 @@ void kernel_body(kernel_arg_t* __UNIFORM__ arg) {
int value = src_ptr[task_id];
key_t key;
uint32_t samples = arg->num_points;
while (samples--) {
hacker(&key, task_id);
if ((key.user & 0x1) == 0) {
value += 1;
}
}
// none taken
if (task_id >= 0x7fffffff) {
value = 0;

View file

@ -78,6 +78,14 @@ void gen_ref_data(std::vector<int>& ref_data, const std::vector<int>& src_data,
for (int i = 0; i < (int)size; ++i) {
int value = src_data.at(i);
key_t key;
uint32_t samples = size;
while (samples--) {
if ((i & 0x1) == 0) {
value += 1;
}
}
// none taken
if (i >= 0x7fffffff) {
value = 0;