[PR #2551] [CLOSED] setup: cpu_info() reads a /proc/cpuinfo without a flags line as no AVX2, not a traceback (#1935) #4116

Closed
opened 2026-11-07 15:33:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2551
Author: @qiuzan2001
Created: 10/15/2026
Status: ❌ Closed

Base: main ← Head: chief-serve/cpuinfo-no-flags


📝 Commits (1)

  • 84eaaf4 setup: cpu_info() reads a /proc/cpuinfo without a flags line as no AVX2, not a traceback (#1935)

📊 Changes

2 files changed (+15 additions, -1 deletions)

View changed files

📝 setup.py (+2 -1)
📝 tools/test_setup_oldcpu.py (+13 -0)

📄 Description

The product half of #1935 (the test half is #2552, separate so each can be taken alone).

What it changes. On Linux, cpu_info() in setup.py took the flags line's regex match without checking it.
aarch64's /proc/cpuinfo lists Features instead, and some emulated x86 containers list neither, so setup stopped
with AttributeError: 'NoneType' object has no attribute 'group' (a traceback on any Linux ARM host). A missing line
now means no flags (no AVX2, no AVX-512), the same way cpu_floor() already reads it (it catches AttributeError);
the CPU name is still read from model name.

What it leaves alone. A /proc/cpuinfo with a flags line (every x86 host this ran on before): the same flags,
AVX2/AVX-512 answer and name. Windows: untouched. What setup does next on an ARM host is unchanged by this PR: it
prints CPU: <name> (no AVX2), cpu_floor says "unsupported", and setup stops with its existing message
("this CPU has neither AVX2 nor SSE4.2 ...") instead of a traceback. That message is about x86; making it name ARM
is left out.

How it was checked.

  • New tools/test_setup_oldcpu.py FloorTest.test_a_cpuinfo_without_flags_1935: an aarch64 cpuinfo (Features)
    and an emulated one (no flags line) give (name, False, False) and floor "unsupported"; a flags line with avx2
    still gives True. On main it fails with the issue's AttributeError.
  • python3 tools/test_setup_oldcpu.py: OK (1 Windows-only skip). test_setup_choices.py, test_setup_amd.py,
    test_setup_stale_stamp.py, test_setup_unsloth.py: OK.
  • Python 3.14, Ubuntu (Linux 7.0), x86-64 (Ryzen 7 5800X3D); the ARM cpuinfo is a fixture, not an ARM machine.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2551 **Author:** [@qiuzan2001](https://github.com/qiuzan2001) **Created:** 10/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `chief-serve/cpuinfo-no-flags` --- ### 📝 Commits (1) - [`84eaaf4`](https://github.com/Niko1221/Strata/commit/84eaaf440fd2785606dc91efedaba089f7a6b2f6) setup: cpu_info() reads a /proc/cpuinfo without a flags line as no AVX2, not a traceback (#1935) ### 📊 Changes **2 files changed** (+15 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `setup.py` (+2 -1) 📝 `tools/test_setup_oldcpu.py` (+13 -0) </details> ### 📄 Description The product half of #1935 (the test half is #2552, separate so each can be taken alone). **What it changes.** On Linux, `cpu_info()` in `setup.py` took the `flags` line's regex match without checking it. aarch64's `/proc/cpuinfo` lists `Features` instead, and some emulated x86 containers list neither, so setup stopped with `AttributeError: 'NoneType' object has no attribute 'group'` (a traceback on any Linux ARM host). A missing line now means no flags (no AVX2, no AVX-512), the same way `cpu_floor()` already reads it (it catches `AttributeError`); the CPU name is still read from `model name`. **What it leaves alone.** A `/proc/cpuinfo` with a `flags` line (every x86 host this ran on before): the same flags, AVX2/AVX-512 answer and name. Windows: untouched. What setup does next on an ARM host is unchanged by this PR: it prints `CPU: <name> (no AVX2)`, `cpu_floor` says "unsupported", and setup stops with its existing message ("this CPU has neither AVX2 nor SSE4.2 ...") instead of a traceback. That message is about x86; making it name ARM is left out. **How it was checked.** - New `tools/test_setup_oldcpu.py` `FloorTest.test_a_cpuinfo_without_flags_1935`: an aarch64 cpuinfo (`Features`) and an emulated one (no flags line) give `(name, False, False)` and floor "unsupported"; a flags line with avx2 still gives `True`. On `main` it fails with the issue's `AttributeError`. - `python3 tools/test_setup_oldcpu.py`: OK (1 Windows-only skip). `test_setup_choices.py`, `test_setup_amd.py`, `test_setup_stale_stamp.py`, `test_setup_unsloth.py`: OK. - Python 3.14, Ubuntu (Linux 7.0), x86-64 (Ryzen 7 5800X3D); the ARM cpuinfo is a fixture, not an ARM machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:33:20 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4116
No description provided.