1+ # !__INTEL_PREVIEW_BREAKING_CHANGES
12# This script is intended to generate "device_aspect_macros.h" from "aspects.def" and "aspects_deprecated.def".
3+ # else
4+ # This script is intended to generate "device_aspect_macros.h" from "aspects.def".
5+ # end !__INTEL_PREVIEW_BREAKING_CHANGES
26
37import os
48import sys
59
10+
11+ # !__INTEL_PREVIEW_BREAKING_CHANGES
612def process_aspects (file_path , is_deprecated = False ):
13+ # else
14+ # def process_aspects(file_path):
15+ # end !__INTEL_PREVIEW_BREAKING_CHANGES
716 with open (file_path , "r" ) as file :
817 content = file .read ()
918 lines = content .strip ().splitlines ()
1019
1120 output = ""
1221 for line in lines :
22+ # !__INTEL_PREVIEW_BREAKING_CHANGES
23+ stripped_line = line .strip ()
24+ if (
25+ not stripped_line
26+ or stripped_line .startswith ("#" )
27+ or stripped_line .startswith ("//" )
28+ ):
29+ continue
1330 if is_deprecated :
14- aspect_macro = (
15- line . strip (). replace ( "__SYCL_ASPECT_DEPRECATED(" , "" ). replace ( ")" , "" )
16- )
31+ aspect_macro = stripped_line . replace (
32+ "__SYCL_ASPECT_DEPRECATED(" , ""
33+ ). replace ( ")" , "" )
1734 aspect_name , aspect_number , _ = aspect_macro .split (
1835 ", " , 2
1936 ) # ignore the third parameter (message)
2037 output += f"// __SYCL_ASPECT_DEPRECATED({ aspect_name } , { aspect_number } )\n "
2138 else :
22- aspect_macro = line . strip () .replace ("__SYCL_ASPECT(" , "" ).replace (")" , "" )
39+ aspect_macro = stripped_line .replace ("__SYCL_ASPECT(" , "" ).replace (")" , "" )
2340 aspect_name , aspect_number = aspect_macro .split (", " )
2441 output += f"// __SYCL_ASPECT({ aspect_name } , { aspect_number } )\n "
42+ # else !__INTEL_PREVIEW_BREAKING_CHANGES
43+ # aspect_macro = line.strip().replace("__SYCL_ASPECT(", "").replace(")", "")
44+ # aspect_name, aspect_number = aspect_macro.split(", ")
45+ # output += f"// __SYCL_ASPECT({aspect_name}, {aspect_number})\n"
46+ # end !__INTEL_PREVIEW_BREAKING_CHANGES
2547
2648 output += f"#ifndef __SYCL_ALL_DEVICES_HAVE_{ aspect_name } __\n "
2749 output += f"#define __SYCL_ALL_DEVICES_HAVE_{ aspect_name } __ 0\n "
@@ -32,6 +54,7 @@ def process_aspects(file_path, is_deprecated=False):
3254
3355 return output
3456
57+
3558header_output = """//==------------------- device_aspect_macros.hpp - SYCL device -------------==//
3659//
3760// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -49,9 +72,15 @@ def process_aspects(file_path, is_deprecated=False):
4972"""
5073
5174include_sycl_dir = sys .argv [1 ]
52- header_output += process_aspects (os .path .join (include_sycl_dir , "info/aspects_deprecated.def" ), is_deprecated = True )
75+ # !__INTEL_PREVIEW_BREAKING_CHANGES
76+ header_output += process_aspects (
77+ os .path .join (include_sycl_dir , "info/aspects_deprecated.def" ), is_deprecated = True
78+ )
79+ # end !__INTEL_PREVIEW_BREAKING_CHANGES
5380header_output += process_aspects (os .path .join (include_sycl_dir , "info/aspects.def" ))
5481
5582build_include_sycl_dir = sys .argv [2 ]
56- with open (os .path .join (build_include_sycl_dir , "device_aspect_macros.hpp" ), "w" ) as header_file :
83+ with open (
84+ os .path .join (build_include_sycl_dir , "device_aspect_macros.hpp" ), "w"
85+ ) as header_file :
5786 header_file .write (header_output )
0 commit comments