Skip to content

[Clang] Unusual Compilation Speed of -O1 #117992

@ADDALBA

Description

@ADDALBA

Unusual Compilation Speed of -O1

During testing with Clang 14.0.6 and Clang 9.0.1, we observed that in certain test cases, the compilation speed with -O1 was very close to that of -O2 or -Ofast, and in some cases even slower. Due to limited resources, we reported only consistently observed anomalies and could not entirely rule out random factors. The Docker image used for testing is available here. Clang was installed using llvm.sh. Detailed test results are as follows:

Test Details

# Test Case: linear-algebra/kernels/bicg
time clang-14 -Ofast -I ./inputs/utilities -I ./inputs/linear-algebra/kernels/bicg ./inputs/utilities/polybench.c ./inputs/linear-algebra/kernels/bicg/bicg.c -DPOLYBENCH_TIME -o ./test
real    0m0.171s
user    0m0.115s
sys     0m0.055s

time clang-14 -O1 -I ./inputs/utilities -I ./inputs/linear-algebra/kernels/bicg ./inputs/utilities/polybench.c ./inputs/linear-algebra/kernels/bicg/bicg.c -DPOLYBENCH_TIME -o ./test
real    0m0.178s
user    0m0.125s
sys     0m0.053s

time clang-9 -Ofast -I ./inputs/utilities -I ./inputs/linear-algebra/kernels/bicg ./inputs/utilities/polybench.c ./inputs/linear-algebra/kernels/bicg/bicg.c -DPOLYBENCH_TIME -o ./test
real    0m0.148s
user    0m0.100s
sys     0m0.048s

time clang-9 -O1 -I ./inputs/utilities -I ./inputs/linear-algebra/kernels/bicg ./inputs/utilities/polybench.c ./inputs/linear-algebra/kernels/bicg/bicg.c -DPOLYBENCH_TIME -o ./test
real    0m0.153s
user    0m0.104s
sys     0m0.047s

# Test Case: linear-algebra/kernels/gemm
time clang-14 -O2 -I ./inputs/utilities -I ./inputs/linear-algebra/kernels/gemm ./inputs/utilities/polybench.c ./inputs/linear-algebra/kernels/gemm/gemm.c -DPOLYBENCH_TIME -o ./test
real    0m0.189s
user    0m0.125s
sys     0m0.064s

time clang-14 -O1 -I ./inputs/utilities -I ./inputs/linear-algebra/kernels/gemm ./inputs/utilities/polybench.c ./inputs/linear-algebra/kernels/gemm/gemm.c -DPOLYBENCH_TIME -o ./test
real    0m0.194s
user    0m0.132s
sys     0m0.063s

time clang-9 -O2 -I ./inputs/utilities -I ./inputs/linear-algebra/kernels/gemm ./inputs/utilities/polybench.c ./inputs/linear-algebra/kernels/gemm/gemm.c -DPOLYBENCH_TIME -o ./test
real    0m0.152s
user    0m0.107s
sys     0m0.045s

time clang-9 -O1 -I ./inputs/utilities -I ./inputs/linear-algebra/kernels/gemm ./inputs/utilities/polybench.c ./inputs/linear-algebra/kernels/gemm/gemm.c -DPOLYBENCH_TIME -o ./test
real    0m0.156s
user    0m0.112s
sys     0m0.044s

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions