Skip to content

[libclc] Remove clspv-specific clc conversions #128500

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

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
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
14 changes: 1 addition & 13 deletions libclc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,6 @@ if ( clspv-- IN_LIST LIBCLC_TARGETS_TO_BUILD OR clspv64-- IN_LIST LIBCLC_TARGETS
DEPENDS ${script_loc} )
add_custom_target( generate-clspv-convert.cl DEPENDS clspv-convert.cl )
set_target_properties( generate-clspv-convert.cl PROPERTIES FOLDER "libclc/Sourcegenning" )

add_custom_command(
OUTPUT clc-clspv-convert.cl
COMMAND ${Python3_EXECUTABLE} ${script_loc} --clc --clspv > clc-clspv-convert.cl
DEPENDS ${script_loc} )
add_custom_target( generate-clc-clspv-convert.cl DEPENDS clc-clspv-convert.cl )
set_target_properties( generate-clc-clspv-convert.cl PROPERTIES FOLDER "libclc/Sourcegenning" )
endif()

enable_testing()
Expand Down Expand Up @@ -314,12 +307,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
endif()

set( clc_lib_files )

if( ARCH STREQUAL clspv OR ARCH STREQUAL clspv64 )
set( clc_gen_files clc-clspv-convert.cl )
else()
set( clc_gen_files clc-convert.cl )
endif()
set( clc_gen_files clc-convert.cl )

libclc_configure_lib_source(
clc_lib_files
Expand Down
15 changes: 12 additions & 3 deletions libclc/generic/lib/gen_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# convert_<destTypen><_sat><_roundingMode>(<sourceTypen>)

import argparse
from sys import stderr

parser = argparse.ArgumentParser()
parser.add_argument(
Expand All @@ -41,6 +42,14 @@
clc = args.clc
clspv = args.clspv


# We don't generate clspv-specific code for clc conversions - don't allow this
# accidentally (later checks rely on mutual exclusivity)
if clc and clspv:
print("Error: clc and clspv conversions are mutually exclusive", file=stderr)
exit(1)


types = [
"char",
"uchar",
Expand Down Expand Up @@ -308,7 +317,7 @@ def generate_default_conversion(src, dst, mode):

# Do not generate user-facing default conversions for clspv as they are handled
# natively
if clc or not clspv:
if not clspv:
for src in types:
for dst in types:
generate_default_conversion(src, dst, "")
Expand All @@ -318,7 +327,7 @@ def generate_default_conversion(src, dst, mode):
for mode in rounding_modes:
# Do not generate user-facing "_rte" conversions for clspv as they
# are handled natively
if clspv and not clc and mode == "_rte":
if clspv and mode == "_rte":
continue
generate_default_conversion(src, dst, mode)

Expand Down Expand Up @@ -560,6 +569,6 @@ def generate_float_conversion(src, dst, size, mode, sat):
for mode in rounding_modes:
# Do not generate user-facing "_rte" conversions for clspv as
# they are handled natively
if clspv and not clc and mode == "_rte":
if clspv and mode == "_rte":
continue
generate_float_conversion(src, dst, size, mode, "")
Loading