Skip to content

sst: compile on non-amd64 architectures - #200

Open
TonyxSun wants to merge 1 commit into
intel:mainfrom
TonyxSun:sst-non-amd64
Open

TonyxSun wants to merge 1 commit into
intel:mainfrom
TonyxSun:sst-non-amd64

Conversation

@TonyxSun

@TonyxSun TonyxSun commented Aug 12, 2026

Copy link
Copy Markdown

Summary

The SST package generates Linux ioctl request declarations in an amd64-only Go file. Importers therefore fail to compile on other architectures before SST support detection can report that the Intel-only feature is unavailable.

This change generates the ISST UAPI declarations into a single architecture-independent file from the Linux/amd64 ABI source. They are fixed-width structs and constants, so they compile everywhere. Device detection and the real ioctl transport remain amd64-only. Non-amd64 builds report SST as unsupported and reject ioctl calls before accessing the device path. It does not emulate SST or enable Intel SST features on ARM.

Native arm64 CI now runs the same make verify and make test targets as amd64. This unblocks ARM64 consumers such as containers/nri-plugins in containers/nri-plugins#461.

Test plan

  • make verify
  • make test in a Linux/arm64 container
  • CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ./...
  • CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build ./...
  • go test ./pkg/sst/... on Linux/amd64 and Linux/arm64
  • Fork Verify workflow, including the native arm64 job

@TonyxSun
TonyxSun marked this pull request as ready for review August 12, 2026 17:03
@TonyxSun
TonyxSun marked this pull request as draft August 12, 2026 17:35
@klihub
klihub requested a balanced review from Copilot August 28, 2026 13:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables SST importers to compile on non-amd64 architectures while keeping SST hardware access amd64-only.

Changes:

  • Splits SST detection and ioctl transport by architecture.
  • Generates compile-only non-amd64 ABI declarations.
  • Adds amd64/arm64 tests and native arm64 CI coverage.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/sst/platform.go Moves architecture-specific detection out of shared code.
pkg/sst/platform_amd64.go Retains device-based SST detection on amd64.
pkg/sst/platform_nonamd64.go Reports SST unsupported on non-amd64.
pkg/sst/platform_amd64_test.go Tests amd64 device detection.
pkg/sst/platform_nonamd64_test.go Tests non-amd64 rejection.
pkg/sst/internal/isst/isst.go Removes shared ioctl transport.
pkg/sst/internal/isst/ioctl_amd64.go Provides the real amd64 ioctl transport.
pkg/sst/internal/isst/ioctl_nonamd64.go Rejects non-amd64 ioctl requests.
pkg/sst/internal/isst/ioctl_nonamd64_test.go Tests deterministic ioctl rejection.
pkg/sst/internal/isst/_types_amd64.go Defines the shared Linux/amd64 generation source.
pkg/sst/internal/isst/types_nonamd64.go Supplies compile-only ABI declarations.
pkg/sst/internal/isst/gen_types.sh Generates both architecture outputs.
.github/workflows/verify.yaml Adds cross-build and native arm64 validation.
Files not reviewed (1)
  • pkg/sst/internal/isst/types_nonamd64.go: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@TonyxSun
TonyxSun marked this pull request as ready for review September 1, 2026 14:04
@TonyxSun

TonyxSun commented Sep 1, 2026

Copy link
Copy Markdown
Author

@klihub this is mostly lift and shift from isst.go and platform.go into platform spcific arch specific src files, and not a lot of change. feel free to review / steer.

@klihub

klihub commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

/cc @marquiz

@klihub
klihub requested review from kad, klihub and marquiz September 2, 2026 06:14

@klihub klihub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TonyxSun This looks fine to me.

I have one micro-nit regarding the commit message itself: the message body is 423 characters long, formatted as a single line. Could you reformat that to multiple lines with <= 72 characters each.

@TonyxSun

TonyxSun commented Sep 4, 2026

Copy link
Copy Markdown
Author

@klihub done! ty for reminder about convention

@marquiz marquiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @TonyxSun for the contribution. Generally looks ok, but some comments below

Comment thread .github/workflows/verify.yaml Outdated
Comment thread pkg/sst/internal/isst/gen_types.sh Outdated
Comment thread .github/workflows/verify.yaml Outdated
Comment thread pkg/sst/platform_unsupported.go
Generated amd64-only SST UAPI declarations prevent packages that
import SST from compiling on other architectures.

Generate the ISST UAPI declarations into an architecture-independent
file from the Linux/amd64 ABI source. They are fixed-width structs and
constants, so they compile everywhere. Gate support detection and
ioctl execution by architecture so non-amd64 callers fail
deterministically, without changing amd64 SST behavior.

Build, lint and test natively on arm64 in CI with the same make verify
and make test targets as amd64.

Signed-off-by: Wuyue (Tony) Sun <68176295+TonyxSun@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants