github.com/weaviate/weaviate@v1.24.6/adapters/repos/db/vector/hnsw/distancer/l2_amd64.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  package distancer
    13  
    14  import (
    15  	"github.com/weaviate/weaviate/adapters/repos/db/vector/hnsw/distancer/asm"
    16  	"golang.org/x/sys/cpu"
    17  )
    18  
    19  func init() {
    20  	if cpu.X86.HasAMXBF16 && cpu.X86.HasAVX512 {
    21  		l2SquaredImpl = asm.L2AVX512
    22  	} else if cpu.X86.HasAVX2 {
    23  		l2SquaredImpl = asm.L2AVX256
    24  	}
    25  }