Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unet compare eager and graph test #55

Closed
wants to merge 3 commits into from

Conversation

Ldpe2G
Copy link

@Ldpe2G Ldpe2G commented Dec 12, 2022

新增 unet eager 和 graph 输出对比测试

为了排除 fused_multi_head_attention_inference 原子操作的影响,attention 中先注释掉 _fused_forward
相关讨论见:https://github.com/Oneflow-Inc/OneTeam/issues/1816#issuecomment-1342214821

测试运行方式:

python3 -m unittest discover -v -s tests/ -p 'test_models_unet_oneflow.py'  -k 
 UNet2DConditionModelTests.test_compare_eager_graph_output

测试思路

首先全部注释掉 tests/test_models_unet_oneflow.py 文件开头的所有环境变量设置,然后通过逐个开启,对比输出最大的 diff,来确定是哪个优化导致 eager 和 graph 输出不一致的。

os.environ["ONEFLOW_MLIR_CSE"] = "1"
os.environ["ONEFLOW_MLIR_ENABLE_INFERENCE_OPTIMIZATION"] = "1"
os.environ["ONEFLOW_MLIR_ENABLE_ROUND_TRIP"] = "1"
os.environ["ONEFLOW_MLIR_FUSE_FORWARD_OPS"] = "1"
os.environ["ONEFLOW_MLIR_GROUP_MATMUL"] = "1"
os.environ["ONEFLOW_MLIR_PREFER_NHWC"] = "1"
os.environ["ONEFLOW_KERNEL_ENABLE_FUSED_CONV_BIAS"] = "1"
os.environ["ONEFLOW_KERNEL_ENABLE_FUSED_LINEAR"] = "1"
os.environ["ONEFLOW_KERENL_CONV_ENABLE_CUTLASS_IMPL"] = "1"
os.environ["ONEFLOW_KERENL_FMHA_ENABLE_TRT_FLASH_ATTN_IMPL"] = "1"
os.environ["ONEFLOW_KERNEL_GLU_ENABLE_DUAL_GEMM_IMPL"] = "1"
os.environ["ONEFLOW_CONV_ALLOW_HALF_PRECISION_ACCUMULATION"] = "1"
os.environ["ONEFLOW_MATMUL_ALLOW_HALF_PRECISION_ACCUMULATION"] = "1"

@Ldpe2G Ldpe2G requested a review from jackalcooper December 12, 2022 12:07
@jackalcooper jackalcooper reopened this Feb 22, 2023
@strint strint closed this Dec 28, 2023
@strint strint reopened this Dec 28, 2023
@strint strint closed this Dec 28, 2023
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.

3 participants