Skip to content

Commit bb000dc

Browse files
committed
process feedback
1 parent 8fd0b5a commit bb000dc

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

Plugins/CodeGeneratorPlugin.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ struct CodeGeneratorPlugin: BuildToolPlugin {
77
let output = context.pluginWorkDirectoryURL
88

99
let floatingPointTypes: [String] = ["Float", "Double"]
10-
let simdSizes = [2, 4, 8, 16, 32, 64]
10+
let simdWidths = [2, 4, 8, 16, 32, 64]
1111

1212
let outputFiles = floatingPointTypes.flatMap { floatingPointType in
13-
simdSizes.flatMap { simdSize in
13+
simdWidths.flatMap { simdWidth in
1414
[
15-
output.appending(component: "SIMD\(simdSize)+\(floatingPointType)+RealFunctions.swift"),
16-
output.appending(component: "SIMD\(simdSize)+\(floatingPointType)+RealFunctions+Derivatives.swift"),
15+
output.appending(component: "SIMD\(simdWidth)+\(floatingPointType)+RealFunctions.swift"),
16+
output.appending(component: "SIMD\(simdWidth)+\(floatingPointType)+RealFunctions+Derivatives.swift"),
1717
]
1818
} + [
1919
output.appending(component: "\(floatingPointType)+RealFunctions+Derivatives.swift"),

Sources/CodeGeneratorExecutable/CodeGenerator.swift

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,30 @@ struct CodeGenerator {
2020
try realFunctionsSIMDExtension.write(to: realFunctionSIMDFileURL, atomically: true, encoding: .utf8)
2121

2222
let floatingPointTypes: [String] = ["Float", "Double"]
23-
let simdSizes: [Int] = [2, 4, 8, 16, 32, 64]
23+
let simdWidths: [Int] = [2, 4, 8, 16, 32, 64]
2424

2525
for floatingPointType in floatingPointTypes {
2626
// Generator Derivatives for RealFunctions for floating point types
2727
let realFunctionDerivativesFileURL = output.appending(
2828
component: "\(floatingPointType)+RealFunctions+Derivatives.swift",
2929
directoryHint: .notDirectory
3030
)
31-
let type = floatingPointType
3231
let realFunctionsDerivativesExtensionCode = RealFunctionsDerivativesGenerator.realFunctionsDerivativesExtension(
33-
type: type,
32+
type: floatingPointType,
3433
floatingPointType: floatingPointType
3534
)
3635
try realFunctionsDerivativesExtensionCode.write(to: realFunctionDerivativesFileURL, atomically: true, encoding: .utf8)
3736

38-
for simdSize in simdSizes {
37+
for simdWidth in simdWidths {
3938
let realFunctionFileURL = output.appending(
40-
component: "SIMD\(simdSize)+\(floatingPointType)+RealFunctions.swift",
39+
component: "SIMD\(simdWidth)+\(floatingPointType)+RealFunctions.swift",
4140
directoryHint: .notDirectory
4241
)
43-
let simdType = "SIMD\(simdSize)<\(floatingPointType)>"
42+
let simdType = "SIMD\(simdWidth)<\(floatingPointType)>"
4443

4544
// no simd methods exist for simd size >= 16 and scalar > Float so we don't add acceleration to those.
46-
var simdAccelerated: Bool
47-
if simdSize > 16 || (simdSize == 16 && floatingPointType == "Double") {
45+
let simdAccelerated: Bool
46+
if simdWidth > 16 || (simdWidth == 16 && floatingPointType == "Double") {
4847
simdAccelerated = false
4948
}
5049
else {
@@ -62,8 +61,8 @@ struct CodeGenerator {
6261

6362
// Generate RealFunctions derivatives for concrete SIMD types
6463
let realFunctionDerivativesFileURL = output
65-
.appending(component: "SIMD\(simdSize)+\(floatingPointType)+RealFunctions+Derivatives.swift")
66-
let type = "SIMD\(simdSize)<\(floatingPointType)>"
64+
.appending(component: "SIMD\(simdWidth)+\(floatingPointType)+RealFunctions+Derivatives.swift")
65+
let type = "SIMD\(simdWidth)<\(floatingPointType)>"
6766
let realFunctionsDerivativesExtensionCode = RealFunctionsDerivativesGenerator.realFunctionsDerivativesExtension(
6867
type: type,
6968
floatingPointType: floatingPointType

0 commit comments

Comments
 (0)