1
1
# SPDX-License-Identifier: Apache-2.0
2
2
# ----------------------------------------------------------------------------
3
- # Copyright 2020-2023 Arm Limited
3
+ # Copyright 2020-2024 Arm Limited
4
4
#
5
5
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
6
6
# use this file except in compliance with the License. You may obtain a copy
@@ -105,9 +105,14 @@ endif()
105
105
if (${ASTCENC_CLI} )
106
106
# Veneer is compiled without any extended ISA so we can safely do
107
107
# ISA compatability checks without triggering a SIGILL
108
- add_library (${ASTCENC_TARGET} -veneer
108
+ add_library (${ASTCENC_TARGET} -veneer1
109
109
astcenccli_entry.cpp )
110
110
111
+ # Veneer is compiled with extended ISA but without vector length overrides
112
+ # so we can safely do SVE vector length compatability checks
113
+ add_library (${ASTCENC_TARGET} -veneer2
114
+ astcenccli_entry2.cpp )
115
+
111
116
add_executable (${ASTCENC_TARGET}
112
117
astcenccli_error_metrics.cpp
113
118
astcenccli_image.cpp
@@ -119,11 +124,12 @@ if(${ASTCENC_CLI})
119
124
120
125
target_link_libraries (${ASTCENC_TARGET}
121
126
PRIVATE
122
- ${ASTCENC_TARGET} -veneer
127
+ ${ASTCENC_TARGET} -veneer1
128
+ ${ASTCENC_TARGET} -veneer2
123
129
${ASTCENC_TARGET} -static )
124
130
endif ()
125
131
126
- macro (astcenc_set_properties ASTCENC_TARGET_NAME ASTCENC_IS_VENEER )
132
+ macro (astcenc_set_properties ASTCENC_TARGET_NAME ASTCENC_VENEER_TYPE )
127
133
128
134
target_compile_features (${ASTCENC_TARGET_NAME}
129
135
PRIVATE
@@ -306,11 +312,17 @@ macro(astcenc_set_properties ASTCENC_TARGET_NAME ASTCENC_IS_VENEER)
306
312
ASTCENC_POPCNT=0
307
313
ASTCENC_F16C=0 )
308
314
309
- # Enable SVE
310
- if (NOT ${ASTCENC_IS_VENEER } )
315
+ # Enable SVE in the core library
316
+ if (NOT ${ASTCENC_VENEER_TYPE } )
311
317
target_compile_options (${ASTCENC_TARGET_NAME}
312
318
PRIVATE
313
319
-march=armv8-a+sve -msve-vector-bits=256 )
320
+
321
+ # Enable SVE without fixed vector length in the veneer
322
+ elseif (${ASTCENC_VENEER_TYPE} EQUAL 2 )
323
+ target_compile_options (${ASTCENC_TARGET_NAME}
324
+ PRIVATE
325
+ -march=armv8-a+sve )
314
326
endif ()
315
327
316
328
elseif (${ASTCENC_ISA_SIMD} MATCHES "sse2" )
@@ -341,7 +353,7 @@ macro(astcenc_set_properties ASTCENC_TARGET_NAME ASTCENC_IS_VENEER)
341
353
ASTCENC_POPCNT=1
342
354
ASTCENC_F16C=0 )
343
355
344
- if (${ASTCENC_IS_VENEER} )
356
+ if (${ASTCENC_VENEER_TYPE} GREATER 0 )
345
357
# Force SSE2 on AppleClang (normally SSE4.1 is the default)
346
358
target_compile_options (${ASTCENC_TARGET_NAME}
347
359
PRIVATE
@@ -366,7 +378,7 @@ macro(astcenc_set_properties ASTCENC_TARGET_NAME ASTCENC_IS_VENEER)
366
378
ASTCENC_POPCNT=1
367
379
ASTCENC_F16C=1 )
368
380
369
- if (${ASTCENC_IS_VENEER} )
381
+ if (${ASTCENC_VENEER_TYPE} GREATER 0 )
370
382
# Force SSE2 on AppleClang (normally SSE4.1 is the default)
371
383
target_compile_options (${ASTCENC_TARGET_NAME}
372
384
PRIVATE
@@ -388,7 +400,7 @@ macro(astcenc_set_properties ASTCENC_TARGET_NAME ASTCENC_IS_VENEER)
388
400
# which significantly improve performance. Note that this DOES reduce
389
401
# image quality by up to 0.2 dB (normally much less), but buys an
390
402
# average of 10-15% performance improvement ...
391
- if ((NOT ${ASTCENC_INVARIANCE} ) AND (NOT ${ASTCENC_IS_VENEER } ))
403
+ if ((NOT ${ASTCENC_INVARIANCE} ) AND (NOT ${ASTCENC_VENEER_TYPE } ))
392
404
target_compile_options (${ASTCENC_TARGET_NAME}
393
405
PRIVATE
394
406
$< ${is_gnu_fe} :-mfma> )
@@ -447,14 +459,19 @@ if(${ASTCENC_SHAREDLIB})
447
459
endif ()
448
460
449
461
if (${ASTCENC_CLI} )
450
- astcenc_set_properties (${ASTCENC_TARGET} -veneer ON )
451
- astcenc_set_properties (${ASTCENC_TARGET} OFF )
462
+ astcenc_set_properties (${ASTCENC_TARGET} -veneer1 1 )
463
+ astcenc_set_properties (${ASTCENC_TARGET} -veneer2 2 )
464
+ astcenc_set_properties (${ASTCENC_TARGET} 0 )
452
465
453
- target_compile_options (${ASTCENC_TARGET}
466
+ target_compile_options (${ASTCENC_TARGET} -veneer1
454
467
PRIVATE
455
468
$< ${is_msvc_fe} :/W3> )
456
469
457
- target_compile_options (${ASTCENC_TARGET} -veneer
470
+ target_compile_options (${ASTCENC_TARGET} -veneer2
471
+ PRIVATE
472
+ $< ${is_msvc_fe} :/W3> )
473
+
474
+ target_compile_options (${ASTCENC_TARGET}
458
475
PRIVATE
459
476
$< ${is_msvc_fe} :/W3> )
460
477
0 commit comments