make execution of workgroups test optional (#643)

This commit is contained in:
Kévin Petit
2020-03-05 08:22:36 +00:00
committed by GitHub
parent 58eb2373a8
commit c9c3c73aa9
2 changed files with 47 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
//
// Copyright (c) 2017 The Khronos Group Inc.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -15,35 +15,57 @@
//
#include "harness/compat.h"
#include "harness/testHarness.h"
#include "procs.h"
#include <stdio.h>
#include <string.h>
#include "procs.h"
#include "harness/testHarness.h"
#if !defined(_WIN32)
#include <unistd.h>
#endif
test_definition test_list[] = {
ADD_TEST( work_group_all ),
ADD_TEST( work_group_any ),
ADD_TEST( work_group_reduce_add ),
ADD_TEST( work_group_reduce_min ),
ADD_TEST( work_group_reduce_max ),
ADD_TEST( work_group_scan_inclusive_add ),
ADD_TEST( work_group_scan_inclusive_min ),
ADD_TEST( work_group_scan_inclusive_max ),
ADD_TEST( work_group_scan_exclusive_add ),
ADD_TEST( work_group_scan_exclusive_min ),
ADD_TEST( work_group_scan_exclusive_max ),
ADD_TEST( work_group_broadcast_1D ),
ADD_TEST( work_group_broadcast_2D ),
ADD_TEST( work_group_broadcast_3D ),
ADD_TEST(work_group_all),
ADD_TEST(work_group_any),
ADD_TEST(work_group_reduce_add),
ADD_TEST(work_group_reduce_min),
ADD_TEST(work_group_reduce_max),
ADD_TEST(work_group_scan_inclusive_add),
ADD_TEST(work_group_scan_inclusive_min),
ADD_TEST(work_group_scan_inclusive_max),
ADD_TEST(work_group_scan_exclusive_add),
ADD_TEST(work_group_scan_exclusive_min),
ADD_TEST(work_group_scan_exclusive_max),
ADD_TEST(work_group_broadcast_1D),
ADD_TEST(work_group_broadcast_2D),
ADD_TEST(work_group_broadcast_3D),
};
const int test_num = ARRAY_SIZE( test_list );
const int test_num = ARRAY_SIZE(test_list);
int main(int argc, const char *argv[])
{
return runTestHarness( argc, argv, test_num, test_list, false, false, 0 );
test_status InitCL(cl_device_id device) {
#ifdef CL_EXPERIMENTAL
auto version = get_device_cl_version(device);
if(version > Version(2,2)) {
int error;
cl_bool isSupported;
error = clGetDeviceInfo(device,
CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT,
sizeof(isSupported), &isSupported, NULL);
if (error != CL_SUCCESS) {
print_error(error, "Unable to query support for collective functions");
return TEST_FAIL;
}
if (isSupported == CL_FALSE) {
return TEST_SKIP;
}
}
#endif
return TEST_PASS;
}
int main(int argc, const char *argv[]) {
return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, 0, InitCL);
}