Skip to content

Concrete SIMD.init(repeating:) and SIMD.init(lowHalf:highHalf:) optimizations #81766

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 5 commits into from
May 27, 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: 11 additions & 3 deletions Runtimes/Core/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,24 @@ if(SwiftCore_ENABLE_COMMANDLINE_SUPPORT)
endif()

if(SwiftCore_ENABLE_VECTOR_TYPES)
gyb_expand(SIMDConcreteOperations.swift.gyb
SIMDConcreteOperations.swift
gyb_expand(SIMDFloatConcreteOperations.swift.gyb
SIMDFloatConcreteOperations.swift
FLAGS "-DCMAKE_SIZEOF_VOID_P=${SwiftCore_SIZEOF_POINTER}")
gyb_expand(SIMDIntegerConcreteOperations.swift.gyb
SIMDIntegerConcreteOperations.swift
FLAGS "-DCMAKE_SIZEOF_VOID_P=${SwiftCore_SIZEOF_POINTER}")
gyb_expand(SIMDMaskConcreteOperations.swift.gyb
SIMDMaskConcreteOperations.swift
FLAGS "-DCMAKE_SIZEOF_VOID_P=${SwiftCore_SIZEOF_POINTER}")
gyb_expand(SIMDVectorTypes.swift.gyb
SIMDVectorTypes.swift
FLAGS "-DCMAKE_SIZEOF_VOID_P=${SwiftCore_SIZEOF_POINTER}")

target_sources(swiftCore PRIVATE
SIMDVector.swift
"${CMAKE_CURRENT_BINARY_DIR}/SIMDConcreteOperations.swift"
"${CMAKE_CURRENT_BINARY_DIR}/SIMDFloatConcreteOperations.swift"
"${CMAKE_CURRENT_BINARY_DIR}/SIMDIntegerConcreteOperations.swift"
"${CMAKE_CURRENT_BINARY_DIR}/SIMDMaskConcreteOperations.swift"
"${CMAKE_CURRENT_BINARY_DIR}/SIMDVectorTypes.swift")
endif()

Expand Down
14 changes: 12 additions & 2 deletions stdlib/public/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,21 @@ split_embedded_sources(
)

if(SWIFT_STDLIB_ENABLE_VECTOR_TYPES)
split_embedded_sources(
OUT_LIST_EMBEDDED SWIFTLIB_EMBEDDED_VECTOR_GYB_SOURCES
OUT_LIST_NORMAL SWIFTLIB_VECTOR_GYB_SOURCES

EMBEDDED SIMDIntegerConcreteOperations.swift.gyb
EMBEDDED SIMDFloatConcreteOperations.swift.gyb
EMBEDDED SIMDMaskConcreteOperations.swift.gyb
EMBEDDED SIMDVectorTypes.swift.gyb
)

list(APPEND SWIFTLIB_SOURCES SIMDVector.swift)
list(APPEND SWIFTLIB_GYB_SOURCES SIMDConcreteOperations.swift.gyb SIMDVectorTypes.swift.gyb)
list(APPEND SWIFTLIB_GYB_SOURCES ${SWIFTLIB_VECTOR_GYB_SOURCES})

list(APPEND SWIFTLIB_EMBEDDED_SOURCES SIMDVector.swift)
list(APPEND SWIFTLIB_EMBEDDED_GYB_SOURCES SIMDConcreteOperations.swift.gyb SIMDVectorTypes.swift.gyb)
list(APPEND SWIFTLIB_EMBEDDED_GYB_SOURCES ${SWIFTLIB_EMBEDDED_VECTOR_GYB_SOURCES})
endif()

# Freestanding and Linux/Android builds both have failures to resolve.
Expand Down
7 changes: 5 additions & 2 deletions stdlib/public/core/GroupInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,12 @@
"FloatingPointTypes.swift",
"FloatingPointRandom.swift"],
"Vector": [
"SIMDConcreteOperations.swift",
"SIMDIntegerConcreteOperations.swift",
"SIMDFloatConcreteOperations.swift",
"SIMDMaskConcreteOperations.swift",
"SIMDVector.swift",
"SIMDVectorTypes.swift"]}
"SIMDVectorTypes.swift"
]}
],
"Optional": [
"Optional.swift"
Expand Down
Loading