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

In the st benchmark some toolchains hoisting/removing the computation from the benchmarking loop #161

Open
MarkHillHuawei opened this issue May 16, 2022 · 4 comments

Comments

@MarkHillHuawei
Copy link

Some of the result variables in embench-iot/st are auto-declared (MeanA, MeanB, VarA, VarB,StddevA, StddevB) and at risk of the computation being removed via DCA/loop hoisting. For example, the inner loop include 3 fp divides per iteration but when armclang/6.14.1 compiles at O3 only one fp divide is performed in the whole benchmark run.

Re-declaring these as globals and calling the main loop body by function pointer seems to prevent this over-optimisation of the benchmark.

@Roger-Shepherd
Copy link
Contributor

I understand why Re-declaring these as globals and calling the main loop body by function pointer might prevent the over optimisation, but what other effects do the changes have? I'd expect performance to go down and code size to go up. Have you measured this?

@MarkHillHuawei
Copy link
Author

It depends on optimisation level and whether hardware FP is used or not. For hardware FP at O3 the performance goes down 20-30% and code size goes up 20-30% because the whole workload is being executed.

@Roger-Shepherd
Copy link
Contributor

Sorry, wasn't clear, I meant - apart from the removal of the "over optimisation" what was the input.

@MarkHillHuawei
Copy link
Author

The input was unchanged, it's an array of numbers which is initialised pseudo-randomly (using the same seed) on each iteration of the benchmark. In theory with aggressive enough constant propagation the compiler could compute the array contents and therefore the resulting stats calculations, but I am not seeing that!

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

No branches or pull requests

2 participants