Skip to content

Commit f74a7e2

Browse files
committed
Merge branch 'dev'
2 parents cc0cdb6 + a15576a commit f74a7e2

8 files changed

Lines changed: 47 additions & 9 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.10)
22

3-
project(xbyak LANGUAGES CXX VERSION 7.36.1)
3+
project(xbyak LANGUAGES CXX VERSION 7.36.2)
44

55
file(GLOB headers xbyak/*.h)
66

doc/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# History
22

3+
* 2026/Apr/17 ver 7.36.2 add fallback when "/sys/devices/cpu_{core,atom}/cpus" does not exist
34
* 2026/Apr/16 ver 7.36.1 fix the construction of StackFrame
45
* 2026/Apr/14 ver 7.36 util::StackFrame supports Use{RSI,RDI,RBP,RBPAsFramePointer}
56
* 2026/Mar/30 ver 7.35.4 fix the encoding of disp8N for vcvthf82ph/vcvt2ph2{b,h}f8[,s]

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
project(
66
'xbyak',
77
'cpp',
8-
version: '7.36.1',
8+
version: '7.36.2',
99
license: 'BSD-3-Clause',
1010
default_options: 'b_ndebug=if-release'
1111
)

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# Xbyak 7.36.1 [![Badge Build]][Build Status]
2+
# Xbyak 7.36.2 [![Badge Build]][Build Status]
33

44
*A JIT assembler for x86/x64 architectures supporting advanced instruction sets up to AVX10.2*
55

readme.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 7.36.1
2+
C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 7.36.2
33

44
-----------------------------------------------------------------------------
55
◎概要
@@ -404,6 +404,7 @@ sample/{echo,hello}.bfは http://www.kmonos.net/alang/etc/brainfuck.php から
404404
-----------------------------------------------------------------------------
405405
◎履歴
406406

407+
2026/04/17 ver 7.36.2 /sys/devices/cpu_{core,atom}/cpusが存在しないときのfallbackを追加
407408
2026/04/16 ver 7.36.1 StackFrameの構築方法を修正
408409
2026/04/14 ver 7.36 util::StackFrameがUse{RSI,RDI,RBP,RBPAsFramePointer}対応
409410
2026/03/30 ver 7.35.4 vcvthf82ph/vcvt2ph2{b,h}f8[,s]のdisp8Nのエンコーディングミス修正

xbyak/xbyak.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ namespace Xbyak {
176176

177177
enum {
178178
DEFAULT_MAX_CODE_SIZE = 4096,
179-
VERSION = 0x7361 /* 0xABCD = A.BC(.D) */
179+
VERSION = 0x7362 /* 0xABCD = A.BC(.D) */
180180
};
181181

182182
#ifndef MIE_INTEGER_TYPE_DEFINED

xbyak/xbyak_mnemonic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const char *getVersionString() const { return "7.36.1"; }
1+
const char *getVersionString() const { return "7.36.2"; }
22
void aadd(const Address& addr, const Reg32e &reg) { opMR(addr, reg, T_0F38, 0x0FC, T_APX); }
33
void aand(const Address& addr, const Reg32e &reg) { opMR(addr, reg, T_0F38|T_66, 0x0FC, T_APX|T_66); }
44
void adc(const Operand& op, uint32_t imm) { opOI(op, imm, 0x10, 2); }

xbyak/xbyak_util.h

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@
101101
#endif
102102
#ifdef _WIN32
103103
#include <windows.h>
104+
#else
105+
#include <sched.h>
104106
#endif
105107
namespace Xbyak { namespace util {
106108
class CpuTopology;
@@ -1564,9 +1566,10 @@ inline bool initCpuTopology(CpuTopology& cpuTopo)
15641566
// Assign core types for hybrid architectures
15651567
const bool isHybrid = cpuTopo.isHybrid();
15661568
if (isHybrid) {
1567-
// For hybrid systems, read P-core and E-core lists from sysfs
1569+
// For hybrid systems, try toread P-core and E-core lists from sysfs first
15681570
CpuMask pCoreMask;
1569-
if (parseCpuList(pCoreMask, "/sys/devices/cpu_core/cpus")) {
1571+
const bool hasPCoreSysfs = parseCpuList(pCoreMask, "/sys/devices/cpu_core/cpus");
1572+
if (hasPCoreSysfs) {
15701573
// Set Performance core types
15711574
for (CpuMask::const_iterator it = pCoreMask.begin(); it != pCoreMask.end(); ++it) {
15721575
uint32_t cpuIdx = *it;
@@ -1576,7 +1579,8 @@ inline bool initCpuTopology(CpuTopology& cpuTopo)
15761579
}
15771580
}
15781581
CpuMask eCoreMask;
1579-
if (parseCpuList(eCoreMask, "/sys/devices/cpu_atom/cpus")) {
1582+
const bool hasECoreSysfs = parseCpuList(eCoreMask, "/sys/devices/cpu_atom/cpus");
1583+
if (hasECoreSysfs) {
15801584
// Set Efficient core types
15811585
for (CpuMask::const_iterator it = eCoreMask.begin(); it != eCoreMask.end(); ++it) {
15821586
uint32_t cpuIdx = *it;
@@ -1585,6 +1589,38 @@ inline bool initCpuTopology(CpuTopology& cpuTopo)
15851589
}
15861590
}
15871591
}
1592+
// Fallback: if either sysfs paths are unavailable, detect both core type per-CPU
1593+
// via CPUID leaf 0x1A (Hybrid Information) by pinning each logical CPU.
1594+
if (!hasPCoreSysfs || !hasECoreSysfs) {
1595+
// CPUID leaf 0x1A EAX[31:24] core type identifiers
1596+
const uint32_t Cpuid_StandardCoreType = 0x40; // P-core (Performance)
1597+
const uint32_t Cpuid_AtomCoreType = 0x20; // E-core (Efficient)
1598+
1599+
cpu_set_t originalMask;
1600+
CPU_ZERO(&originalMask);
1601+
if (sched_getaffinity(0, sizeof(cpu_set_t), &originalMask) != 0) goto SKIP_FALLBACK;
1602+
1603+
for (uint32_t cpu = 0; cpu < logicalCpuNum; cpu++) {
1604+
cpu_set_t cpuMask;
1605+
CPU_ZERO(&cpuMask);
1606+
CPU_SET(cpu, &cpuMask);
1607+
if (sched_setaffinity(0, sizeof(cpu_set_t), &cpuMask) == 0) {
1608+
// CPUID leaf 0x1A: Hybrid Information
1609+
uint32_t data[4] = {};
1610+
Cpu::getCpuidEx(0x1A, 0, data);
1611+
const uint32_t coreTypeField = (data[0] >> 24) & 0xFF;
1612+
if (coreTypeField == Cpuid_StandardCoreType) {
1613+
cpuTopo.logicalCpus_[cpu].coreType = Performance;
1614+
} else if (coreTypeField == Cpuid_AtomCoreType) {
1615+
cpuTopo.logicalCpus_[cpu].coreType = Efficient;
1616+
}
1617+
}
1618+
}
1619+
1620+
// Restore the original CPU affinity mask
1621+
sched_setaffinity(0, sizeof(cpu_set_t), &originalMask);
1622+
SKIP_FALLBACK:;
1623+
}
15881624
}
15891625

15901626
// Read coherency line size

0 commit comments

Comments
 (0)