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

Make unit testing symbols available even in the case if unit tests are disabled. #628

Merged
merged 1 commit into from
Oct 31, 2023
Merged
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
10 changes: 6 additions & 4 deletions src/unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifdef CLVK_UNIT_TESTING_ENABLED

#include "device.hpp"
#include "log.hpp"

Expand All @@ -22,28 +20,32 @@
extern "C" {
void CL_API_CALL clvk_override_device_max_compute_work_group_count(
cl_device_id device, uint32_t x, uint32_t y, uint32_t z) {
#ifdef CLVK_UNIT_TESTING_ENABLED
cvk_debug_fn("x: %u, y: %u, z: %u\n", x, y, z);
assert(device != nullptr && icd_downcast(device)->is_valid());
auto& vklimits = icd_downcast(device)->vulkan_limits_writable();

vklimits.maxComputeWorkGroupCount[0] = x;
vklimits.maxComputeWorkGroupCount[1] = y;
vklimits.maxComputeWorkGroupCount[2] = z;
#endif
}

void CL_API_CALL clvk_restore_device_properties(cl_device_id device) {
#ifdef CLVK_UNIT_TESTING_ENABLED
cvk_debug_fn("device: %p\n", (void*)device);
assert(device != nullptr && icd_downcast(device)->is_valid());

icd_downcast(device)->restore_device_properties();
#endif
}

void CL_API_CALL clvk_override_printf_buffer_size(uint32_t size) {
#ifdef CLVK_UNIT_TESTING_ENABLED
auto printf_buffer_size =
(config_value<uint32_t>*)&config.printf_buffer_size;
printf_buffer_size->value = size;
printf_buffer_size->set = true;
#endif
}
}

#endif