Skip to content

Commit 02c90bb

Browse files
authored
[UR][CTS] Spec wording around PROGRAM_INFO_BINARIES and test (#19321)
The wording of the spec was a bit confusing, so it has been clarified. The conformance test was also updated to be more robust, which unfortunately exposes failures in HIP and Cuda.
1 parent 3e85a76 commit 02c90bb

5 files changed

Lines changed: 14 additions & 5 deletions

File tree

unified-runtime/include/ur_api.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unified-runtime/include/ur_print.hpp

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unified-runtime/scripts/core/program.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ etors:
385385
- name: BINARY_SIZES
386386
desc: "[size_t[]] Return program binary sizes for each device."
387387
- name: BINARIES
388-
desc: "[unsigned char[]] Return program binaries for all devices for this Program. These are not null-terminated."
388+
desc: "[unsigned char *[]] Write program binaries into caller-provided buffers for each device. These are not null-terminated."
389389
- name: NUM_KERNELS
390390
desc: "[size_t][optional-query] Number of kernels in Program, return type size_t."
391391
- name: KERNEL_NAMES

unified-runtime/scripts/templates/print.hpp.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const ur_bool
284284
%>case ${ename}: {
285285
%if th.value_traits.is_array(vtype):
286286
<% atype = th.value_traits.get_array_name(vtype) %>
287-
%if 'void' in atype:
287+
%if 'void' in atype or '*' in atype:
288288
const ${atype} const *tptr = (const ${atype} const*)ptr;
289289
%else:
290290
const ${atype} *tptr = (const ${atype} *)ptr;

unified-runtime/test/conformance/program/urProgramGetInfo.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ TEST_P(urProgramGetInfoTest, SuccessBinarySizes) {
153153
}
154154

155155
TEST_P(urProgramGetInfoTest, SuccessBinaries) {
156+
// Not implemented correctly on these targets - they copy their own pointer into the output rather than copying the
157+
// binary
158+
UUR_KNOWN_FAILURE_ON(uur::HIP{}, uur::CUDA{});
159+
156160
size_t binary_sizes_len = 0;
157161
std::vector<char> property_value(0);
158162

@@ -175,6 +179,11 @@ TEST_P(urProgramGetInfoTest, SuccessBinaries) {
175179
urProgramGetInfo(program, UR_PROGRAM_INFO_BINARIES, sizeof(binaries[0]),
176180
binaries, nullptr),
177181
UR_PROGRAM_INFO_BINARIES);
182+
183+
// We assume that there is at least 1 non-zero byte in the binary
184+
bool nonzero_found = std::any_of(property_value.begin(), property_value.end(),
185+
[](char c) { return c != 0; });
186+
ASSERT_TRUE(nonzero_found);
178187
}
179188

180189
TEST_P(urProgramGetInfoTest, SuccessNumKernels) {

0 commit comments

Comments
 (0)