zeroshade commented on code in PR #37785:
URL: https://github.com/apache/arrow/pull/37785#discussion_r1331768871
##########
go/parquet/internal/bmi/bmi_arm64.go:
##########
@@ -14,40 +14,38 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//go:build !noasm
// +build !noasm
package bmi
import (
"os"
"strings"
-)
-import (
- "golang.org/x/sys/cpu"
+
+ "github.com/klauspost/cpuid/v2"
)
func init() {
- // Added ability to enable extension via environment:
+ // Added ability to enable extension via environment:
// ARM_ENABLE_EXT=NEON go test
if ext, ok := os.LookupEnv("ARM_ENABLE_EXT"); ok {
exts := strings.Split(ext, ",")
for _, x := range exts {
switch x {
case "NEON":
- cpu.ARM64.HasASIMD = true
+ cpuid.CPU.Enable(cpuid.ASIMD)
case "AES":
- cpu.ARM64.HasAES = true
+ cpuid.CPU.Enable(cpuid.AESARM)
case "PMULL":
- cpu.ARM64.HasPMULL = true
+ cpuid.CPU.Enable(cpuid.PMULL)
default:
- cpu.ARM64.HasASIMD = false
- cpu.ARM64.HasAES = false
- cpu.ARM64.HasPMULL = false
+ cpuid.CPU.Disable(cpuid.ASIMD, cpuid.AESARM,
cpuid.PMULL)
Review Comment:
technically we aren't actually *disabling* the extensions on the CPU, we're
just telling the library that anything that wants to check for those extensions
should consider them disabled and act accordingly. For example if an invalid
value is passed we behave as if those extensions weren't enabled regardless and
default to the pure go implementation.
That said, I agree it would be more user-friendly to have an explicit
"DISABLE" value, and then just print a warning for invalid values. I'll make
that change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]