mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-06-27 08:50:02 -04:00
extending divergence test coverage
This commit is contained in:
parent
5dbfcecc21
commit
aaeb7ba644
4 changed files with 47 additions and 0 deletions
|
@ -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;
|
||||
}
|
|
@ -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);
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue