Skip to content

Commit 6855efa

Browse files
committed
Merge remote-tracking branch 'upstream/main' into uwe/native_cpu
2 parents c212ec2 + a898ec9 commit 6855efa

File tree

18 files changed

+197
-116
lines changed

18 files changed

+197
-116
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ List of options provided by CMake:
112112
| UR_USE_UBSAN | Enable UndefinedBehavior Sanitizer | ON/OFF | OFF |
113113
| UR_USE_MSAN | Enable MemorySanitizer (clang only) | ON/OFF | OFF |
114114
| UR_ENABLE_TRACING | Enable XPTI-based tracing layer | ON/OFF | OFF |
115+
| UR_CONFORMANCE_TARGET_TRIPLES | SYCL triples to build CTS device binaries for | Comma-separated list | spir64 |
115116

116117
### Additional make targets
117118

include/ur.py

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,53 +2264,6 @@ def __str__(self):
22642264
###############################################################################
22652265
__use_win_types = "Windows" == platform.uname()[0]
22662266

2267-
###############################################################################
2268-
## @brief Function-pointer for urLoaderConfigCreate
2269-
if __use_win_types:
2270-
_urLoaderConfigCreate_t = WINFUNCTYPE( ur_result_t, POINTER(ur_loader_config_handle_t) )
2271-
else:
2272-
_urLoaderConfigCreate_t = CFUNCTYPE( ur_result_t, POINTER(ur_loader_config_handle_t) )
2273-
2274-
###############################################################################
2275-
## @brief Function-pointer for urLoaderConfigRetain
2276-
if __use_win_types:
2277-
_urLoaderConfigRetain_t = WINFUNCTYPE( ur_result_t, ur_loader_config_handle_t )
2278-
else:
2279-
_urLoaderConfigRetain_t = CFUNCTYPE( ur_result_t, ur_loader_config_handle_t )
2280-
2281-
###############################################################################
2282-
## @brief Function-pointer for urLoaderConfigRelease
2283-
if __use_win_types:
2284-
_urLoaderConfigRelease_t = WINFUNCTYPE( ur_result_t, ur_loader_config_handle_t )
2285-
else:
2286-
_urLoaderConfigRelease_t = CFUNCTYPE( ur_result_t, ur_loader_config_handle_t )
2287-
2288-
###############################################################################
2289-
## @brief Function-pointer for urLoaderConfigGetInfo
2290-
if __use_win_types:
2291-
_urLoaderConfigGetInfo_t = WINFUNCTYPE( ur_result_t, ur_loader_config_handle_t, ur_loader_config_info_t, c_size_t, c_void_p, POINTER(c_size_t) )
2292-
else:
2293-
_urLoaderConfigGetInfo_t = CFUNCTYPE( ur_result_t, ur_loader_config_handle_t, ur_loader_config_info_t, c_size_t, c_void_p, POINTER(c_size_t) )
2294-
2295-
###############################################################################
2296-
## @brief Function-pointer for urLoaderConfigEnableLayer
2297-
if __use_win_types:
2298-
_urLoaderConfigEnableLayer_t = WINFUNCTYPE( ur_result_t, ur_loader_config_handle_t, c_char_p )
2299-
else:
2300-
_urLoaderConfigEnableLayer_t = CFUNCTYPE( ur_result_t, ur_loader_config_handle_t, c_char_p )
2301-
2302-
2303-
###############################################################################
2304-
## @brief Table of LoaderConfig functions pointers
2305-
class ur_loader_config_dditable_t(Structure):
2306-
_fields_ = [
2307-
("pfnCreate", c_void_p), ## _urLoaderConfigCreate_t
2308-
("pfnRetain", c_void_p), ## _urLoaderConfigRetain_t
2309-
("pfnRelease", c_void_p), ## _urLoaderConfigRelease_t
2310-
("pfnGetInfo", c_void_p), ## _urLoaderConfigGetInfo_t
2311-
("pfnEnableLayer", c_void_p) ## _urLoaderConfigEnableLayer_t
2312-
]
2313-
23142267
###############################################################################
23152268
## @brief Function-pointer for urPlatformGet
23162269
if __use_win_types:
@@ -3792,7 +3745,6 @@ class ur_device_dditable_t(Structure):
37923745
###############################################################################
37933746
class ur_dditable_t(Structure):
37943747
_fields_ = [
3795-
("LoaderConfig", ur_loader_config_dditable_t),
37963748
("Platform", ur_platform_dditable_t),
37973749
("Context", ur_context_dditable_t),
37983750
("Event", ur_event_dditable_t),

scripts/YaML.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,12 +599,14 @@ class ur_name_t(Structure):
599599
* A function requires the following scalar fields: {`desc`, `name`}
600600
- `desc` will be used as the function's description comment
601601
- `name` must be a unique ISO-C standard identifier, and be PascalCase
602-
* A function may take the following optional scalar fields: {`class`, `decl`, `condition`, `ordinal`, `version`}
602+
* A function may take the following optional scalar fields: {`class`, `decl`, `condition`, `ordinal`, `version`, `loader_only`}
603603
- `class` will be used to scope the function declaration within the specified C++ class
604604
- `decl` will be used to specify the function's linkage as one of the following: {`static`}
605605
- `condition` will be used as a C/C++ preprocessor `#if` conditional expression
606606
- `ordinal` will be used to override the default order (in which they appear) the function appears within its section; `default="1000"`
607607
- `version` will be used to define the minimum API version in which the function will appear; `default="1.0"` This will also affect the order in which the function appears within its section and class.
608+
- `loader_only` will be used to decide whether the function will only be implemented by the loader and not appear in the adapters
609+
interface.
608610
* A function requires the following sequence of mappings: {`params`}
609611
- A param requires the following scalar fields: {`desc`, `type`, `name`}
610612
+ `desc` will be used as the params's description comment

scripts/core/runtime.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ etors:
3131
type: function
3232
desc: "Create a loader config object."
3333
class: $xLoaderConfig
34+
loader_only: True
3435
name: Create
3536
decl: static
3637
params:
@@ -41,6 +42,7 @@ params:
4142
type: function
4243
desc: "Get a reference to the loader config object."
4344
class: $xLoaderConfig
45+
loader_only: True
4446
name: Retain
4547
decl: static
4648
details:
@@ -55,6 +57,7 @@ params:
5557
type: function
5658
desc: "Release config handle."
5759
class: $xLoaderConfig
60+
loader_only: True
5861
name: Release
5962
decl: static
6063
details:
@@ -80,6 +83,7 @@ etors:
8083
type: function
8184
desc: "Retrieves various information about the loader."
8285
class: $xLoaderConfig
86+
loader_only: True
8387
name: GetInfo
8488
decl: static
8589
details:
@@ -122,6 +126,7 @@ returns:
122126
type: function
123127
desc: "Enable a layer for the specified loader config."
124128
class: $xLoaderConfig
129+
loader_only: True
125130
name: EnableLayer
126131
decl: static
127132
params:

scripts/templates/api.py.mako

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ class ${N}_DDI:
178178
self.__dll.${x}Init(0, 0)
179179

180180
%for tbl in tables:
181-
%if 'Loader' in tbl['name']:
182-
<% continue %>
183-
%endif
184181
# call driver to get function pointers
185182
${tbl['name']} = ${tbl['type']}()
186183
r = ${x}_result_v(self.__dll.${tbl['export']['name']}(version, byref(${tbl['name']})))

scripts/templates/ddi.h.mako

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ extern "C" {
3131
#endif
3232

3333
%for tbl in th.get_pfntables(specs, meta, n, tags):
34-
%if 'Loader' in tbl['export']['name']:
35-
<% continue %>
36-
%endif
3734
%for obj in tbl['functions']:
3835
///////////////////////////////////////////////////////////////////////////////
3936
/// @brief Function-pointer for ${th.make_func_name(n, tags, obj)}
@@ -97,9 +94,6 @@ typedef ${x}_result_t (${X}_APICALL *${tbl['pfn']})(
9794
typedef struct ${n}_dditable_t
9895
{
9996
%for tbl in th.get_pfntables(specs, meta, n, tags):
100-
%if 'loader' in tbl['type']:
101-
<% continue %>
102-
%endif
10397
${th.append_ws(tbl['type'], 35)} ${tbl['name']};
10498
%endfor
10599
} ${n}_dditable_t;

scripts/templates/helper.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,14 @@ def is_global(item, tags):
440440
except:
441441
return False
442442

443+
@staticmethod
444+
def is_loader_only(item):
445+
try:
446+
return item['loader_only']
447+
except:
448+
return False
449+
450+
443451
"""
444452
Public:
445453
substitutes each tag['key'] with tag['value']
@@ -1047,6 +1055,9 @@ def get_pfntables(specs, meta, namespace, tags):
10471055
tables = []
10481056
for cname in sorted(meta['class'], key=lambda x: meta['class'][x]['ordinal']):
10491057
objs, exp_objs = get_class_function_objs_exp(specs, cname)
1058+
objs = list(filter(lambda obj: not function_traits.is_loader_only(obj), objs))
1059+
exp_objs = list(filter(lambda obj: not function_traits.is_loader_only(obj), exp_objs))
1060+
10501061
if len(objs) > 0:
10511062
name = get_table_name(namespace, tags, objs[0])
10521063
table = "%s_%s_dditable_t"%(namespace, _camel_to_snake(name))
@@ -1111,6 +1122,7 @@ def get_pfntables(specs, meta, namespace, tags):
11111122

11121123
return tables
11131124

1125+
11141126
"""
11151127
Private:
11161128
returns the list of parameters, filtering based on desc tags

scripts/templates/libapi.cpp.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ ${th.make_func_name(n, tags, obj)}(
5656
%endfor
5757
)
5858
try {
59-
%if 'Loader' in obj['class']:
59+
%if th.function_traits.is_loader_only(obj):
6060
return ur_lib::${th.make_func_name(n, tags, obj)}(${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} );
6161
%else:
6262
%if re.match("Init", obj['name']):

scripts/templates/libddi.cpp.mako

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ namespace ${x}_lib
3333
${x}_result_t result = ${X}_RESULT_SUCCESS;
3434

3535
%for tbl in th.get_pfntables(specs, meta, n, tags):
36-
%if 'Loader' in tbl['export']['name']:
37-
<% continue %>
38-
%endif
3936
if( ${X}_RESULT_SUCCESS == result )
4037
{
4138
result = ${tbl['export']['name']}( ${X}_API_VERSION_CURRENT, &${n}DdiTable.${tbl['name']} );

test/conformance/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ if(DEFINED UR_DPCXX)
6464
"${CMAKE_CURRENT_BINARY_DIR}/device_binaries/")
6565
file(MAKE_DIRECTORY ${UR_CONFORMANCE_DEVICE_BINARIES_DIR})
6666

67-
if(DEFINED UR_CONFORMANCE_TARGET_TRIPLES)
67+
if(NOT "${UR_CONFORMANCE_TARGET_TRIPLES}" STREQUAL "")
6868
string(REPLACE "," ";" TARGET_TRIPLES ${UR_CONFORMANCE_TARGET_TRIPLES})
6969
else()
70+
message(WARNING "UR_CONFORMANCE_TARGET_TRIPLES wasn't set, defaulting to only generate spir64 device binaries")
7071
list(APPEND TARGET_TRIPLES "spir64")
7172
endif()
7273

0 commit comments

Comments
 (0)