Skip to content

Commit 5c786e6

Browse files
neurlangYour Name
authored andcommitted
Fix compilation on android/arm64
1 parent 2b22284 commit 5c786e6

File tree

4 files changed

+35
-28
lines changed

4 files changed

+35
-28
lines changed

hash/hashvectorized.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !noasm && amd64
12
package hash
23

34
import "github.com/klauspost/cpuid/v2"
@@ -13,22 +14,6 @@ func init() {
1314
}
1415
}
1516

16-
// HashVectorized implement many Neurlang hashes in parallel, using something like AVX-512 or similar
17-
var HashVectorized func(out []uint32, n []uint32, s []uint32, max uint32)
18-
19-
var hashVectorizedParallelism int
20-
21-
// HashVectorizedParallelism reports the recommended number of hashes to compute in parallel on this platform
22-
// Can't return 0.
23-
func HashVectorizedParallelism() int {
24-
return hashVectorizedParallelism
25-
}
26-
27-
func hashNotVectorized(out []uint32, n []uint32, s []uint32, max uint32) {
28-
for i := range out {
29-
out[i] = Hash(n[i], s[i], max)
30-
}
31-
}
3217
func hashAVX512Vectorized(out []uint32, n []uint32, s []uint32, max uint32) {
3318
hashVectorizedAVX512(&out[0], &n[0], &s[0], max, uint32(len(out)))
3419
// self-checking

hash/hashvectorizedall.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package hash
2+
3+
// HashVectorized implement many Neurlang hashes in parallel, using something like AVX-512 or similar
4+
var HashVectorized func(out []uint32, n []uint32, s []uint32, max uint32) = hashNotVectorized
5+
6+
var hashVectorizedParallelism int = 1
7+
8+
// HashVectorizedParallelism reports the recommended number of hashes to compute in parallel on this platform
9+
// Can't return 0.
10+
func HashVectorizedParallelism() int {
11+
return hashVectorizedParallelism
12+
}
13+
14+
func hashNotVectorized(out []uint32, n []uint32, s []uint32, max uint32) {
15+
for i := range out {
16+
out[i] = Hash(n[i], s[i], max)
17+
}
18+
}

learning/avx/avx.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Package AVX implements the learning stage of the Neurlang classifier on AVX
1+
//go:build !noasm && amd64
22
package avx
33

44
import "github.com/klauspost/cpuid/v2"
@@ -14,17 +14,6 @@ func init() {
1414
}
1515
}
1616

17-
// ScatterGatherVectorizedParallelism reports the recommended number of scatter gather to compute in parallel on this platform
18-
// Can't return 0.
19-
func ScatterGatherVectorizedParallelism() int {
20-
return scatterGatherVectorizedParallelism
21-
}
22-
23-
// ScatterGatherVectorized implement many scatter gather in parallel, using something like AVX-512 or similar
24-
var ScatterGatherVectorized func(outs []uint32, buf []uint32, size *int, wh uint32) bool
25-
26-
var scatterGatherVectorizedParallelism int
27-
2817

2918
func scatterGatherAVX512Vectorized(outs []uint32, buf []uint32, size *int, wh uint32) bool
3019

learning/avx/avxall.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Package AVX implements the learning stage of the Neurlang classifier on AVX
2+
package avx
3+
4+
// ScatterGatherVectorizedParallelism reports the recommended number of scatter gather to compute in parallel on this platform
5+
// Can't return 0.
6+
func ScatterGatherVectorizedParallelism() int {
7+
return scatterGatherVectorizedParallelism
8+
}
9+
10+
// ScatterGatherVectorized implement many scatter gather in parallel, using something like AVX-512 or similar
11+
var ScatterGatherVectorized func(outs []uint32, buf []uint32, size *int, wh uint32) bool = scatterGatherNotVectorized
12+
13+
var scatterGatherVectorizedParallelism int = 1
14+
15+

0 commit comments

Comments
 (0)