You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sizing: on a price tie, prefer the smallest type that fits (hpc7g cpu=16 → hpc7g.16xlarge) #610
A spec asking for 16 vCPU in the hpc7g family was sized to hpc7g.16xlarge (64 vCPU) — 4× the request. Three separate specs asking for 16, 32 and 64 vCPU all resolved to the same hpc7g.16xlarge.
Every hpc7g size costs exactly the same — verified against the AWS Price List:
type
vCPU
memory
$/hr
hpc7g.4xlarge
16
128 GiB
1.6832
hpc7g.8xlarge
32
128 GiB
1.6832
hpc7g.16xlarge
64
128 GiB
1.6832
On hpc7g you rent the socket, not the cores (AWS markets this as selectable cores per node for per-core licensing). So "cheapest type that fits" has no preference among the three, and the tie appears to resolve toward the largest.
truffle available hpc7g.4xlarge --regions us-east-1 also reports $1.6832/hr, so truffle's data is right — this is purely the tie-break.
Why it matters
Two reasons beyond tidiness:
Blast radius. A request for 16 vCPU silently becoming 64 is 4× the cores. Here the price is identical so the bill is unchanged, but that is a property of hpc7g specifically — the same tie-break on any family with genuinely equal-priced sizes would over-provision at cost.
It makes a measurement unreachable. I was measuring memory bandwidth per core across hpc7g sizes (8 / 4 / 2 GB per core on a constant socket). That experiment needs the three sizes distinguished, and there is no way to express it: cpu/memory cannot discriminate (all three have 128 GiB), and the tie sends everything to the largest.
Suggested
Prefer the smallest type that fits when price ties. It matches what the spec asked for and minimises blast radius; nothing is lost when the rate is equal.
Allow a spec to pin an exact instance type — e.g. resources.instance_type, the way --ami pins the image. There is already a precedent for overriding auto-selection, and a cross-size sweep needs it by construction. Today the only escape is to stop using the sizing path.
Workaround
Swept thread counts on a single hpc7g.16xlarge socket instead of renting three sizes — which turned out to be the better experiment (one instance, and it isolates cores-on-a-constant-socket cleanly) and cheaper. So this is a rough edge rather than a blocker.
Found while measuring SIMD and memory bandwidth across Graviton generations for the scientific-codes-cookbook; spawn version in use was 0.111.1.
hpc7g.16xlarge wins because '1' < '4', not because it's the biggest. The distinction matters: on a family whose sizes are 2xlarge/4xlarge/8xlarge this same code picks the smallest and looks entirely correct. The bug only manifests when a family mixes a 1-prefixed double-digit size (10/12/16/24/48xlarge) with single-digit ones — which is why it went unnoticed, and why a regression test has to use a 16xlarge-style family or it passes vacuously.
Your suggested fix is the right one: on a price tie, prefer the smallest that fits. Candidate already carries VCPUs and MemoryGiB, so the comparator becomes vCPU → memory → name (name retained last, purely for determinism).
resources.instance_type already exists — sorry, that's on our docs
You can pin an exact type today, and it does precisely what you wanted:
"resources": { "instance_type": "hpc7g.4xlarge" }
Size() short-circuits a pin as its first action, before any truffle or pricing call (pkg/taskproto/sizer.go, added in #413 for nf-spawn's ext.instanceType); family/cpu/memory are ignored when it's set. So the three-size sweep was expressible, and you didn't need to leave the sizing path.
The reason you couldn't find it is a genuine failure on our side: instance_type is documented only in design docs (docs/pooled-task-execution-design.md, docs/workflow-adapter-protocol-rfc.md) and appears nowhere user-facing — not in docs-gen/task.md, not in task run --help. A capability that exists but is only described in an internal design note is, for practical purposes, missing. That gets fixed alongside the tie-break.
(For what it's worth, your workaround was still the better experiment — one socket, cores varied — so nothing was lost.)
Fixing both: the comparator, and documenting the pin where someone sizing a task would actually look.
Activity
scttfrdmn commentedon Sep 25, 2026
Investigated both asks. One is a real bug with a sneakier cause than either of us assumed; the other already exists and we simply never told you.
The tie-break isn't biased toward the largest — it's lexicographic
taskproto.Sizeranks by price and then:Plain string comparison. And:
hpc7g.16xlargewins because'1' < '4', not because it's the biggest. The distinction matters: on a family whose sizes are2xlarge/4xlarge/8xlargethis same code picks the smallest and looks entirely correct. The bug only manifests when a family mixes a1-prefixed double-digit size (10/12/16/24/48xlarge) with single-digit ones — which is why it went unnoticed, and why a regression test has to use a16xlarge-style family or it passes vacuously.Your suggested fix is the right one: on a price tie, prefer the smallest that fits.
Candidatealready carriesVCPUsandMemoryGiB, so the comparator becomes vCPU → memory → name (name retained last, purely for determinism).resources.instance_typealready exists — sorry, that's on our docsYou can pin an exact type today, and it does precisely what you wanted:
Size()short-circuits a pin as its first action, before any truffle or pricing call (pkg/taskproto/sizer.go, added in #413 for nf-spawn'sext.instanceType); family/cpu/memory are ignored when it's set. So the three-size sweep was expressible, and you didn't need to leave the sizing path.The reason you couldn't find it is a genuine failure on our side:
instance_typeis documented only in design docs (docs/pooled-task-execution-design.md,docs/workflow-adapter-protocol-rfc.md) and appears nowhere user-facing — not indocs-gen/task.md, not intask run --help. A capability that exists but is only described in an internal design note is, for practical purposes, missing. That gets fixed alongside the tie-break.(For what it's worth, your workaround was still the better experiment — one socket, cores varied — so nothing was lost.)
Fixing both: the comparator, and documenting the pin where someone sizing a task would actually look.
test(iam): one coverage gate for every spore.host principal's AWS cal…
test(iam): one coverage gate for every spore.host principal's AWS cal…