Loading...
Loading...
Complete AscendC Operator Verification Testcase Generation - Help users with testcase design. Use this skill when users mention testcase design, generalized testcase generation, operator benchmark, UT testcase, precision testcase, or performance testcase.
npx skill4agent add ascend/agent-skills ascendc-operator-testcase-gendesign.mdascendc-operator-designascendc-operator-ut-genascendc-operator-precision-evalascendc-operator-performance-evaldesign.mdtemplates/test-cases-template.mddesign.mdSUPPORTED_DTYPESdesign.mdTEST_SHAPES| Dimension | Recommended Shape | Applicable Operator Type |
|---|---|---|
| 1D | (128,), (1024,), (4096,), (8192,) | elementwise, reduction |
| 2D | (32, 512), (64, 768), (128, 1024) | elementwise, matmul, linear |
| 3D | (8, 16, 64), (4, 128, 256) | elementwise, attention, conv1d |
| 4D | (4, 8, 32, 16), (2, 64, 32, 32) | conv2d, elementwise |
| 5D | (2, 3, 4, 5, 6) | conv3d, elementwise |
Avoid Oversized Shapes: It is recommended that the number of elements in a single shape ≤ 200K.
TEST_SHAPES = [
("category_name", "description", (dim0, dim1, ...)),
# ...
]# elementwise operator (supports any dimension)
TEST_SHAPES = [
("1D", "128 elements", (128,)),
("1D", "1024 elements", (1024,)),
("1D", "4096 elements", (4096,)),
("1D", "8192 elements", (8192,)),
("2D", "32x512", (32, 512)),
("3D", "8x16x64", (8, 16, 64)),
("3D", "4x128x256", (4, 128, 256)),
("4D", "4x8x32x16", (4, 8, 32, 16)),
]GENERAL_SHAPES| Dimension | Small Shape | Testing Purpose |
|---|---|---|
| 1D | (1,), (2,), (4,), (8,) | Minimum elements, boundary values |
| 1D | (3,), (5,), (7,) | Misaligned lengths |
| 2D | (1, 1), (2, 2), (4, 4) | Tiny 2D tensor |
| 2D | (1, 128), (2, 256) | Single row/column scenario |
| 3D | (1, 1, 1), (2, 2, 2) | Tiny 3D tensor |
| 3D | (1, 8, 64), (2, 16, 128) | Single batch scenario |
| Dimension | Large Shape | Applicable Model | Number of Elements |
|---|---|---|---|
| 1D | (3072,), (4096,) | BERT FFN middle layer | 3K-4K |
| 1D | (5120,), (6400,) | GPT-2 FFN middle layer | 5K-6K |
| 2D | (512, 768) | BERT-base full sequence | 393K |
| 2D | (512, 1024) | BERT-large full sequence | 524K |
| 2D | (1024, 768) | GPT-2 sequence | 786K |
| 2D | (1024, 1024) | GPT-2 medium sequence | 1M |
| 2D | (1024, 1600) | GPT-2 XL sequence | 1.6M |
| 3D | (8, 512, 768) | BERT-base batch | 3.1M |
| 3D | (8, 197, 768) | ViT-base batch | 1.2M |
| 3D | (16, 1024, 1024) | GPT-2 large batch | 16.7M |
Notes:
- Recommended shapes for production environments and typical model scenarios should vary according to the specific application scenario of each operator
- Small shapes are used for boundary testing to ensure the operator works correctly with minimal inputs
- Large shapes are used for performance testing and verification of correctness with large-scale data
- Shapes with more than 200K elements are only used for generalized testing and not in regular testing
GENERAL_SHAPES = [
("Small", "description", (dim0, dim1, ...)),
("Large", "description", (dim0, dim1, ...)),
# ...
]# elementwise operator (supports any dimension)
GENERAL_SHAPES = [
# Small Shape Scenarios
("Small", "single element", (1,)),
("Small", "tiny vector 2", (2,)),
("Small", "tiny vector 4", (4,)),
("Small", "unaligned length 3", (3,)),
("Small", "unaligned length 5", (5,)),
("Small", "2x2 matrix", (2, 2)),
("Small", "1x128 single row", (1, 128)),
("Small", "1x1x1 scalar", (1, 1, 1)),
("Small", "1x8x64 single batch", (1, 8, 64)),
# Large Shape Scenarios (Production Environment)
("Large", "BERT-base FFN 3072", (3072,)),
("Large", "BERT-large FFN 4096", (4096,)),
("Large", "BERT-base 512x768", (512, 768)),
("Large", "BERT-large 512x1024", (512, 1024)),
("Large", "GPT-2 1024x768", (1024, 768)),
("Large", "GPT-2 1024x1024", (1024, 1024)),
("Large", "ViT-base 8x197x768", (8, 197, 768)),
]templates/test-cases-template.mdcsrc/ops/[op-name]/test/[op-name]-test-cases.mdascend-kernel/csrc/ops/[op-name]/test/[op-name]-test-cases.mdascendc-operator-precision-evalascendc-operator-performance-evalascend-kernel/csrc/ops/[op-name]/test/[op-name]-test-cases.md