Skip to content

feat(ec2): seed eleven accelerated instance-type families completely (#896) - #1030

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/ec2-accelerated-catalog-896
Sep 17, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/ec2-accelerated-catalog-896

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

The catalog held one accelerated size per family — p3.2xlarge, g4dn.xlarge, inf1.xlarge — as a deliberate exception to the completeness the seven general-purpose families have. The recorded reason was that "the accelerated families are large, their specs vary widely across sizes, and no consumer has asked for more of them." Two-thirds of that is still true and stays in the doc comment; the third clause is what changed. #891, #892 and #894 each describe behaviour that cannot be exercised with the inputs their reporters use, because g6.xlarge is not in the catalog.

Eleven families, forty-one types where there were three, complete per family in the same sense c5 is complete — bare metal excluded as it is everywhere else in the catalog, which costs the table exactly one size (g4dn.metal):

Family Sizes Accelerator
p3 2xlarge, 8xlarge, 16xlarge NVIDIA V100
p4d 24xlarge NVIDIA A100 40 GiB
p4de 24xlarge NVIDIA A100 80 GiB
p5 4xlarge, 48xlarge NVIDIA H100
g4dn xlarge … 16xlarge (6) NVIDIA T4
g5 xlarge … 48xlarge (8) NVIDIA A10G
g6 xlarge … 48xlarge (8) NVIDIA L4
inf1 xlarge, 2xlarge, 6xlarge, 24xlarge Inferentia
inf2 xlarge, 8xlarge, 24xlarge, 48xlarge Inferentia2
trn1 2xlarge, 32xlarge Trainium
trn2 3xlarge, 48xlarge Trainium2

Specs are from https://docs.aws.amazon.com/ec2/latest/instancetypes/ac.html and, for p3, .../pg.html. Five families AWS publishes beside these are deliberately out, each for its own reason, recorded in the doc comment and in docs/services.md: p3dn, trn1n, p5e and p5en are each their own single-size family (omitting a whole family is what the catalog already does everywhere); trn2u.48xlarge is published with "✗ No" in both accelerator columns, and inferring 16 from trn2.48xlarge would be substrate inventing a spec; g5g is Graviton, and the build function hardcodes x86_64 for every entry.

GPUs moves off the family, into a second table

The issue's fourth criterion asks that GPUs be "set per family". That is not possible for these families, and the correction is recorded on #896 rather than implied by this diff. AWS publishes counts that are neither constant within a family nor monotonic in size:

  • g4dn, g5 and g6 each have a 12xlarge carrying four and a 16xlarge — the next size up — carrying one;
  • g5 and g6 have a 24xlarge carrying four below a 48xlarge carrying eight;
  • inf2's counts run 1, 1, 6, 12.

ec2InstanceTypeFamily.GPUs existed only because the catalog held one accelerated size per family — its own comment said so — and that condition is what this change removes, so the field is deleted.

The count lives on a new row type ec2AcceleratedSize in a second table, ec2AcceleratedFamilies, rather than on ec2InstanceTypeSize: those literals are positional across roughly sixty rows in seven general-purpose families, so a fifth field means touching every row of a table this change has no business in, to add a value that is zero in all of them.

One function still flattens both tables into the single catalog and index. That is the invariant the split had to preserve, and it exists because #234's parallel spot-price map silently dropped types from DescribeSpotPriceHistory. Adding a second table is precisely the change that could reintroduce that hazard, so the test this PR leads with asserts it directly: DescribeInstanceTypes, DescribeInstanceTypeOfferings (at LocationType=region) and DescribeSpotPriceHistory (at one AZ) must return the same type list in the same order.

Inferentia and Trainium report no gpuInfo at all

InstanceTypeInfo splits accelerators across five members (gpuInfo, inferenceAcceleratorInfo, neuronInfo, fpgaInfo, mediaAcceleratorInfo); substrate models gpuInfo only. inf1's zero has been the recorded reading since #234 — "real EC2 does not report [Inferentia] through gpuInfo" — and inf2, trn1 and trn2 follow it. Those thirteen types therefore render no gpuInfo element, which is not the same thing as a zero count and is what a naive fix produces; a test pins the absence on raw bytes with a g6.xlarge control asserting the element is there for a NVIDIA family.

The counts are recorded in the table even though nothing reports them, so the research is not repeated. #1029 carries the blocker: neither InferenceAcceleratorInfo's nor NeuronInfo's reference page states which member a Neuron device populates, and InferenceAcceleratorInfo additionally carries "Amazon Elastic Inference is no longer available."

Spot prices keep the rule and the seeded values

Rates are per GiB of memory, per the existing rule, with the three #234 values preserved verbatim and their families calibrated from them: g4dn 0.01175 from g4dn.xlarge 0.188, inf1 0.0095 from inf1.xlarge 0.076, and p3 0.918 per 61 GiB — which makes p3.8xlarge and p3.16xlarge exact multiples of the seeded p3.2xlarge value. The eight families with no seeded value get substrate's rates, ordered so a newer generation costs more per GiB than the one it replaces (g4dn < g5 < g6; inf1 < inf2; trn1 < trn2; p3 < p4d < p4de < p5).

A test asserts each family's rate against every one of its sizes. That is not ceremony: it is the only check on a column of hand-computed decimals, and a mistyped digit in one row would leave every other assertion in the file passing.

RunInstances accepting a type DescribeInstanceTypes refuses is recorded, not fixed

The issue's fifth criterion allows either. The evidence that decided it: six instance types are launched by fixtures in this repository and none of them is in the catalog — m7i.large (×5), t2.micro (×2), c7i.xlarge (×2), t4g.nano, m7i.xlarge, c6a.xlarge. Validating at launch would refuse types AWS plainly offers, which is the same failure the completeness invariant exists to prevent, moved onto the operation that creates state.

docs/services.md states the divergence, its reason, and the consequence a caller needs: an instance's reported instanceType is recorded intent, not an assertion that substrate models the type. A test asserts the divergence rather than the fix, so closing it later is a deliberate edit here and not a silent behaviour change.

Found while doing this, filed rather than fixed

Tests

Six new tests in emulator/ec2_accelerated_instancetypes_test.go, all through the wire:

  • the three catalog operations return the same list in the same order, and every accelerated type is in it;
  • one subtest per type asserts it is assertable through InstanceType.1;
  • an 18-row table pins vCPUs, memory and GPU count for every inversion AWS publishes;
  • the nine inf/trn types carry no gpuInfo in the raw body, with a g6.xlarge control;
  • every family's spot rate is checked per size against its first size's rate, with the three EC2 plugin: add DescribeInstanceTypes, DescribeInstanceTypeOfferings, DescribeSpotPriceHistory #234 values asserted verbatim and strict monotonic increase within each family;
  • RunInstances accepts m7i.large and DescribeInstanceTypes refuses it with InvalidInstanceType/400.

One pre-existing expectation moved and is not a defect: TestEC2_DescribeInstanceTypeOfferings_InstanceTypeFilter/a_mid-string_wildcard asserted *.24xlarge matched five types; six accelerated families now carry a 24xlarge, so it matches eleven.

Verification

gofmt/build/vet, golangci-lint, make test and GOTOOLCHAIN=go1.26.6 make test, coverage, docs-reference/docs-reference-check/docs-versions/authz-reference-check, the docs build and the e2e suite all pass. Coverage 85.0% emulator / 84.6% total, against an 85.0%/84.5% baseline.

Closes #896.

…896)

The catalog held one accelerated size per family — p3.2xlarge, g4dn.xlarge,
inf1.xlarge — as a deliberate exception to the completeness the seven
general-purpose families have. The recorded reason was that the accelerated
families are large, their specs vary widely across sizes, and no consumer had
asked for more of them. The third clause stopped being true: #891, #892 and #894
each describe behaviour that cannot be exercised with the inputs their reporters
use, because g6.xlarge is not in the catalog.

Eleven families, forty-one types where there were three: p3, p4d, p4de, p5,
g4dn, g5, g6, inf1, inf2, trn1, trn2 — complete per family in the same sense c5
is complete, bare metal excluded as it is everywhere else (which costs the table
exactly one size, g4dn.metal). Specs come from AWS's accelerated-computing and
previous-generation instance-type guides.

GPUs moves off the family and onto the size, in a second table

AWS publishes accelerator counts that are neither constant within a family nor
monotonic in size: g4dn, g5 and g6 each have a 12xlarge carrying four and a
16xlarge — the next size up — carrying one; g5 and g6 have a 24xlarge carrying
four below a 48xlarge carrying eight; inf2 runs 1, 1, 6, 12. So
ec2InstanceTypeFamily.GPUs, whose own comment said one value per family was
enough only because the catalog held a single accelerated size, is deleted.

The count lives on a new row type ec2AcceleratedSize in a second table,
ec2AcceleratedFamilies, rather than on ec2InstanceTypeSize: those literals are
positional across roughly sixty rows in seven general-purpose families, so a
fifth field means touching every row of a table this change has no business in,
to add a value that is zero in all of them.

One function still flattens both tables into the single catalog and index, which
is the invariant the split had to preserve — it exists because #234's parallel
spot-price map silently dropped types from DescribeSpotPriceHistory. The test
this change leads with asserts it directly: DescribeInstanceTypes,
DescribeInstanceTypeOfferings and DescribeSpotPriceHistory must return the same
type list in the same order.

Inferentia and Trainium report no gpuInfo at all

InstanceTypeInfo splits accelerators across five members; substrate models
gpuInfo only. inf1's zero has been the recorded reading since #234, and inf2,
trn1 and trn2 follow it — so those thirteen types render no gpuInfo element,
which is not the same thing as a zero count, and the test pins the absence on
raw bytes with a g6.xlarge control. Their counts are recorded in the table so
the research is not repeated, and #1029 carries the blocker: neither
InferenceAcceleratorInfo's nor NeuronInfo's reference page states which member a
Neuron device populates.

Spot prices keep the rule and the seeded values

Rates are per GiB of memory, with the three #234 values preserved verbatim and
their families calibrated from them: g4dn 0.01175 from g4dn.xlarge 0.188, inf1
0.0095 from inf1.xlarge 0.076, and p3 0.918 per 61 GiB, which makes p3.8xlarge
and p3.16xlarge exact multiples of the seeded p3.2xlarge value. The eight
families with no seeded value get substrate's rates, ordered so a newer
generation costs more per GiB than the one it replaces. A test asserts each
family's rate against every one of its sizes — the only check on a column of
hand-computed decimals, where a mistyped digit would leave every other assertion
in the file passing.

RunInstances accepting a type DescribeInstanceTypes refuses is recorded

Six instance types are launched by fixtures in this repository and none is in
the catalog, so validating at launch would refuse types AWS plainly offers.
docs/services.md states the divergence and its consequence — an instance's
reported instanceType is recorded intent, not an assertion that substrate models
the type — and a test asserts the divergence rather than the fix, so closing it
later is a deliberate edit rather than a silent behaviour change.

Found and filed rather than fixed: #1028, describeInstanceTypes hardcodes
currentGeneration=true and p3 is the one family AWS publishes as previous
generation. Reporting it accurately requires evaluating the current-generation
filter in the same change, since an accurate member beside an inert filter would
let a caller filter on current-generation=true and get p3 back carrying false.

Closes #896.
@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 5dd830d into main Sep 17, 2026
17 checks passed
@scttfrdmn
scttfrdmn deleted the feat/ec2-accelerated-catalog-896 branch September 17, 2026 15:15
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.

EC2 instance-type catalog carries no current-generation accelerated types, and RunInstances does not validate against it

1 participant