Repository navigation
feat(ec2): seed eleven accelerated instance-type families completely (#896) - #1030
Merged
Merged
Conversation
…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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, becauseg6.xlargeis not in the catalog.Eleven families, forty-one types where there were three, complete per family in the same sense
c5is complete — bare metal excluded as it is everywhere else in the catalog, which costs the table exactly one size (g4dn.metal):p32xlarge,8xlarge,16xlargep4d24xlargep4de24xlargep54xlarge,48xlargeg4dnxlarge…16xlarge(6)g5xlarge…48xlarge(8)g6xlarge…48xlarge(8)inf1xlarge,2xlarge,6xlarge,24xlargeinf2xlarge,8xlarge,24xlarge,48xlargetrn12xlarge,32xlargetrn23xlarge,48xlargeSpecs are from
https://docs.aws.amazon.com/ec2/latest/instancetypes/ac.htmland, forp3,.../pg.html. Five families AWS publishes beside these are deliberately out, each for its own reason, recorded in the doc comment and indocs/services.md:p3dn,trn1n,p5eandp5enare each their own single-size family (omitting a whole family is what the catalog already does everywhere);trn2u.48xlargeis published with "✗ No" in both accelerator columns, and inferring 16 fromtrn2.48xlargewould be substrate inventing a spec;g5gis Graviton, and the build function hardcodesx86_64for every entry.GPUsmoves off the family, into a second tableThe issue's fourth criterion asks that
GPUsbe "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,g5andg6each have a12xlargecarrying four and a16xlarge— the next size up — carrying one;g5andg6have a24xlargecarrying four below a48xlargecarrying eight;inf2's counts run 1, 1, 6, 12.ec2InstanceTypeFamily.GPUsexisted 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
ec2AcceleratedSizein a second table,ec2AcceleratedFamilies, rather than onec2InstanceTypeSize: 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(atLocationType=region) andDescribeSpotPriceHistory(at one AZ) must return the same type list in the same order.Inferentia and Trainium report no
gpuInfoat allInstanceTypeInfosplits accelerators across five members (gpuInfo,inferenceAcceleratorInfo,neuronInfo,fpgaInfo,mediaAcceleratorInfo); substrate modelsgpuInfoonly.inf1's zero has been the recorded reading since #234 — "real EC2 does not report [Inferentia] through gpuInfo" — andinf2,trn1andtrn2follow it. Those thirteen types therefore render nogpuInfoelement, 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 ag6.xlargecontrol 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 norNeuronInfo's reference page states which member a Neuron device populates, andInferenceAcceleratorInfoadditionally 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:
g4dn0.01175 fromg4dn.xlarge0.188,inf10.0095 frominf1.xlarge0.076, andp30.918 per 61 GiB — which makesp3.8xlargeandp3.16xlargeexact multiples of the seededp3.2xlargevalue. 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.
RunInstancesaccepting a typeDescribeInstanceTypesrefuses is recorded, not fixedThe 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.mdstates the divergence, its reason, and the consequence a caller needs: an instance's reportedinstanceTypeis 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
describeInstanceTypeshardcodescurrentGeneration=true, andp3is the one family AWS publishes on the previous-generation page. It was already wrong forp3.2xlargebefore this change and is now wrong for three rows. Reporting it accurately requires evaluating thecurrent-generationfilter in the same change, since an accurate member beside one of the fifty-two inert filters would let a caller filter oncurrent-generation=trueand getp3back carryingfalse— worse than the uniform wrong value.docs/services.mdstates it in the meantime.Tests
Six new tests in
emulator/ec2_accelerated_instancetypes_test.go, all through the wire:InstanceType.1;inf/trntypes carry nogpuInfoin the raw body, with ag6.xlargecontrol;RunInstancesacceptsm7i.largeandDescribeInstanceTypesrefuses it withInvalidInstanceType/400.One pre-existing expectation moved and is not a defect:
TestEC2_DescribeInstanceTypeOfferings_InstanceTypeFilter/a_mid-string_wildcardasserted*.24xlargematched five types; six accelerated families now carry a24xlarge, so it matches eleven.Verification
gofmt/build/vet,golangci-lint,make testandGOTOOLCHAIN=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.