mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-13 15:07:10 +08:00
vendor: github.com/moby/buildkit v0.21.0-rc1
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
15
vendor/golang.org/x/sys/cpu/cpu.go
generated
vendored
15
vendor/golang.org/x/sys/cpu/cpu.go
generated
vendored
@ -72,6 +72,9 @@ var X86 struct {
|
||||
HasSSSE3 bool // Supplemental streaming SIMD extension 3
|
||||
HasSSE41 bool // Streaming SIMD extension 4 and 4.1
|
||||
HasSSE42 bool // Streaming SIMD extension 4 and 4.2
|
||||
HasAVXIFMA bool // Advanced vector extension Integer Fused Multiply Add
|
||||
HasAVXVNNI bool // Advanced vector extension Vector Neural Network Instructions
|
||||
HasAVXVNNIInt8 bool // Advanced vector extension Vector Neural Network Int8 instructions
|
||||
_ CacheLinePad
|
||||
}
|
||||
|
||||
@ -146,6 +149,18 @@ var ARM struct {
|
||||
_ CacheLinePad
|
||||
}
|
||||
|
||||
// The booleans in Loong64 contain the correspondingly named cpu feature bit.
|
||||
// The struct is padded to avoid false sharing.
|
||||
var Loong64 struct {
|
||||
_ CacheLinePad
|
||||
HasLSX bool // support 128-bit vector extension
|
||||
HasLASX bool // support 256-bit vector extension
|
||||
HasCRC32 bool // support CRC instruction
|
||||
HasLAM_BH bool // support AM{SWAP/ADD}[_DB].{B/H} instruction
|
||||
HasLAMCAS bool // support AMCAS[_DB].{B/H/W/D} instruction
|
||||
_ CacheLinePad
|
||||
}
|
||||
|
||||
// MIPS64X contains the supported CPU features of the current mips64/mips64le
|
||||
// platforms. If the current platform is not mips64/mips64le or the current
|
||||
// operating system is not Linux then all feature flags are false.
|
||||
|
22
vendor/golang.org/x/sys/cpu/cpu_linux_loong64.go
generated
vendored
Normal file
22
vendor/golang.org/x/sys/cpu/cpu_linux_loong64.go
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2025 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cpu
|
||||
|
||||
// HWCAP bits. These are exposed by the Linux kernel.
|
||||
const (
|
||||
hwcap_LOONGARCH_LSX = 1 << 4
|
||||
hwcap_LOONGARCH_LASX = 1 << 5
|
||||
)
|
||||
|
||||
func doinit() {
|
||||
// TODO: Features that require kernel support like LSX and LASX can
|
||||
// be detected here once needed in std library or by the compiler.
|
||||
Loong64.HasLSX = hwcIsSet(hwCap, hwcap_LOONGARCH_LSX)
|
||||
Loong64.HasLASX = hwcIsSet(hwCap, hwcap_LOONGARCH_LASX)
|
||||
}
|
||||
|
||||
func hwcIsSet(hwc uint, val uint) bool {
|
||||
return hwc&val != 0
|
||||
}
|
2
vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go
generated
vendored
2
vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go
generated
vendored
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x && !riscv64
|
||||
//go:build linux && !arm && !arm64 && !loong64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x && !riscv64
|
||||
|
||||
package cpu
|
||||
|
||||
|
38
vendor/golang.org/x/sys/cpu/cpu_loong64.go
generated
vendored
38
vendor/golang.org/x/sys/cpu/cpu_loong64.go
generated
vendored
@ -8,5 +8,43 @@ package cpu
|
||||
|
||||
const cacheLineSize = 64
|
||||
|
||||
// Bit fields for CPUCFG registers, Related reference documents:
|
||||
// https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_cpucfg
|
||||
const (
|
||||
// CPUCFG1 bits
|
||||
cpucfg1_CRC32 = 1 << 25
|
||||
|
||||
// CPUCFG2 bits
|
||||
cpucfg2_LAM_BH = 1 << 27
|
||||
cpucfg2_LAMCAS = 1 << 28
|
||||
)
|
||||
|
||||
func initOptions() {
|
||||
options = []option{
|
||||
{Name: "lsx", Feature: &Loong64.HasLSX},
|
||||
{Name: "lasx", Feature: &Loong64.HasLASX},
|
||||
{Name: "crc32", Feature: &Loong64.HasCRC32},
|
||||
{Name: "lam_bh", Feature: &Loong64.HasLAM_BH},
|
||||
{Name: "lamcas", Feature: &Loong64.HasLAMCAS},
|
||||
}
|
||||
|
||||
// The CPUCFG data on Loong64 only reflects the hardware capabilities,
|
||||
// not the kernel support status, so features such as LSX and LASX that
|
||||
// require kernel support cannot be obtained from the CPUCFG data.
|
||||
//
|
||||
// These features only require hardware capability support and do not
|
||||
// require kernel specific support, so they can be obtained directly
|
||||
// through CPUCFG
|
||||
cfg1 := get_cpucfg(1)
|
||||
cfg2 := get_cpucfg(2)
|
||||
|
||||
Loong64.HasCRC32 = cfgIsSet(cfg1, cpucfg1_CRC32)
|
||||
Loong64.HasLAMCAS = cfgIsSet(cfg2, cpucfg2_LAMCAS)
|
||||
Loong64.HasLAM_BH = cfgIsSet(cfg2, cpucfg2_LAM_BH)
|
||||
}
|
||||
|
||||
func get_cpucfg(reg uint32) uint32
|
||||
|
||||
func cfgIsSet(cfg uint32, val uint32) bool {
|
||||
return cfg&val != 0
|
||||
}
|
||||
|
13
vendor/golang.org/x/sys/cpu/cpu_loong64.s
generated
vendored
Normal file
13
vendor/golang.org/x/sys/cpu/cpu_loong64.s
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2025 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// func get_cpucfg(reg uint32) uint32
|
||||
TEXT ·get_cpucfg(SB), NOSPLIT|NOFRAME, $0
|
||||
MOVW reg+0(FP), R5
|
||||
// CPUCFG R5, R4 = 0x00006ca4
|
||||
WORD $0x00006ca4
|
||||
MOVW R4, ret+8(FP)
|
||||
RET
|
21
vendor/golang.org/x/sys/cpu/cpu_x86.go
generated
vendored
21
vendor/golang.org/x/sys/cpu/cpu_x86.go
generated
vendored
@ -53,6 +53,9 @@ func initOptions() {
|
||||
{Name: "sse41", Feature: &X86.HasSSE41},
|
||||
{Name: "sse42", Feature: &X86.HasSSE42},
|
||||
{Name: "ssse3", Feature: &X86.HasSSSE3},
|
||||
{Name: "avxifma", Feature: &X86.HasAVXIFMA},
|
||||
{Name: "avxvnni", Feature: &X86.HasAVXVNNI},
|
||||
{Name: "avxvnniint8", Feature: &X86.HasAVXVNNIInt8},
|
||||
|
||||
// These capabilities should always be enabled on amd64:
|
||||
{Name: "sse2", Feature: &X86.HasSSE2, Required: runtime.GOARCH == "amd64"},
|
||||
@ -106,7 +109,7 @@ func archInit() {
|
||||
return
|
||||
}
|
||||
|
||||
_, ebx7, ecx7, edx7 := cpuid(7, 0)
|
||||
eax7, ebx7, ecx7, edx7 := cpuid(7, 0)
|
||||
X86.HasBMI1 = isSet(3, ebx7)
|
||||
X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX
|
||||
X86.HasBMI2 = isSet(8, ebx7)
|
||||
@ -134,14 +137,24 @@ func archInit() {
|
||||
X86.HasAVX512VAES = isSet(9, ecx7)
|
||||
X86.HasAVX512VBMI2 = isSet(6, ecx7)
|
||||
X86.HasAVX512BITALG = isSet(12, ecx7)
|
||||
|
||||
eax71, _, _, _ := cpuid(7, 1)
|
||||
X86.HasAVX512BF16 = isSet(5, eax71)
|
||||
}
|
||||
|
||||
X86.HasAMXTile = isSet(24, edx7)
|
||||
X86.HasAMXInt8 = isSet(25, edx7)
|
||||
X86.HasAMXBF16 = isSet(22, edx7)
|
||||
|
||||
// These features depend on the second level of extended features.
|
||||
if eax7 >= 1 {
|
||||
eax71, _, _, edx71 := cpuid(7, 1)
|
||||
if X86.HasAVX512 {
|
||||
X86.HasAVX512BF16 = isSet(5, eax71)
|
||||
}
|
||||
if X86.HasAVX {
|
||||
X86.HasAVXIFMA = isSet(23, eax71)
|
||||
X86.HasAVXVNNI = isSet(4, eax71)
|
||||
X86.HasAVXVNNIInt8 = isSet(4, edx71)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func isSet(bitpos uint, value uint32) bool {
|
||||
|
4
vendor/golang.org/x/sys/cpu/parse.go
generated
vendored
4
vendor/golang.org/x/sys/cpu/parse.go
generated
vendored
@ -13,7 +13,7 @@ import "strconv"
|
||||
// https://golang.org/cl/209597.
|
||||
func parseRelease(rel string) (major, minor, patch int, ok bool) {
|
||||
// Strip anything after a dash or plus.
|
||||
for i := 0; i < len(rel); i++ {
|
||||
for i := range len(rel) {
|
||||
if rel[i] == '-' || rel[i] == '+' {
|
||||
rel = rel[:i]
|
||||
break
|
||||
@ -21,7 +21,7 @@ func parseRelease(rel string) (major, minor, patch int, ok bool) {
|
||||
}
|
||||
|
||||
next := func() (int, bool) {
|
||||
for i := 0; i < len(rel); i++ {
|
||||
for i := range len(rel) {
|
||||
if rel[i] == '.' {
|
||||
ver, err := strconv.Atoi(rel[:i])
|
||||
rel = rel[i+1:]
|
||||
|
Reference in New Issue
Block a user