Conversation
268dd80 to
99be90d
Compare
greatly reduced the code required for specific operators; added strided tensor support;
voltjia
approved these changes
Oct 21, 2025
Collaborator
voltjia
left a comment
There was a problem hiding this comment.
目前用起来问题不大,描述中给出的命令也都可以顺利运行,可以先合并后面再更新。
有几个小问题,后面可以看看需不需要更改一下:
_TEST_CASES_DATA和parse_add_test_case这俩的命名读起来似乎略有不对劲,但是问题不大。test/infinicore下同时存在ops文件夹和ops.py,可能会出现冲突问题,比如后面如果有需要import的时候,也许会有问题,但也有可能压根不会需要import这些。
Merged
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.
目前,
先写了一个框架;
加了add和matmul的测试;
加了rms_norm和attention(叫attention_temp)的测试,主要是验证框架对测例的处理,调用姿势跟torch没对齐;
用法跟以前一致
python test/infinicore/ops/matmul.py --nvidia --bench以前的--profile改为--bench,其余不变
test/infinicore/ops.py可以运行所有算子测试对于一个具体算子的测试,需要:
[区别部分]
需要自己定义_TEST_CASES_DATA,包含所有测试用例,格式随意。其中
TestCase.BOTH、TestCase.IN_PLACE、TestCase.OUT_OF_PLACE可以区分测试类型TestCase(operation_mode, inputs, output)的形式返回给_TEST_CASES或者get_test_cases(self)_TENSOR_DTYPES = [infinicore.float16, infinicore.bfloat16, infinicore.float32]如果需要混合数据类型,templates.py上面给了一些定义方法,可以参考rms_norm.py中_DTYPE_COMBINATIONS的定义方式。
class OpTest(BaseOperatorTest)init中字符用算子名。
get_test_cases, get_tensor_dtype, get_tolerance_map可以复制粘贴。
torch_operator和infinicore_operator用来定义torch和infinicore的定义方法,原则上应该基本一致。
否则不需要定义
[相同部分]