-
Notifications
You must be signed in to change notification settings - Fork 349
Tools: Testbench: xt-testbench #6513
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
Conversation
|
one more question is: where is the entry for this testbench? |
src/tools/testbench |
661b239 to
ed4a9a7
Compare
b8fdb51 to
8142001
Compare
8142001 to
3cad3f5
Compare
3cad3f5 to
aedaecf
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
Thanks @marc-hb the file DAI may be missing some DAI operation that fuzzer expects. |
aedaecf to
3c7dfd6
Compare
lyakh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand it correctly, that we currently can run testbench tests on the host multi-threaded and after this PR we won't be able to do that any more? Cannot we keep both modes?
Yep, this is what it does... @lgirdwood can we restore the multi-threading with your work for alsa plugin so we could have both? My idea is that I would get the improvements for topology parser and IPC simulation to xt-testbench from the plugin work. So this would be an intermediate step. Or wait to have both somehow. |
|
Can one of the admins verify this patch? |
tools/testbench/testbench.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't double be %lf?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double is overkill for this, I'll change the equation to float. The table https://cplusplus.com/reference/cstdio/printf/ suggests that L would be used for long double, while l seems to be for integers unless I'm misunderstanding it.
singalsu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now addressed review feedback, thanks for the comments!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing 0x%lx to 0x%zx seems be OK for both gcc and xcc, I'll update the patch with it.
tools/testbench/testbench.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I've added functions to get time and cycles. The patch now also computes MCPS with file read/write consumption excluded.
tools/testbench/testbench.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, yes that works!
tools/testbench/testbench.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double is overkill for this, I'll change the equation to float. The table https://cplusplus.com/reference/cstdio/printf/ suggests that L would be used for long double, while l seems to be for integers unless I'm misunderstanding it.
0205810 to
ffdb170
Compare
|
Now run of e.g. Input sample (frame) count: 326400 (163200) |
tools/testbench/testbench.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long long for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, yes changed now!
ffdb170 to
d7cd418
Compare
marc-hb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caught one $TPLGFN typo, otherwise shell script changes LGTM
tools/test/audio/comp_run.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
| echo "Error: topology $TPLGFN does not exist." | |
| echo "Error: topology $TPLG does not exist." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, the previous print was without path. Better this way.
tools/test/audio/comp_run.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, I have no idea what's wrong with this indent. My emacs bash mode indents this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mix of tabs and spaces again?
scripts/rebuild-testbench.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I have no idea what's wrong with indent. Help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces on one line and tabs on the next feels fishy, even for shell scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unfortunate that we have some files with tabs and other files with spaces in the same project but I agree 100% with @paulstelian97 : let's please not cross the line where we have a mix of tabs and spaces in the same file!
So @singalsu please find the shortcut in your editor that lets you quickly switch between tabs and spaces like the rest of us :-)
PS: I can't resist sorry: this sort of time-consuming discussion is exactly why tabs suck. Off-topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file is already without my patch a mix of tabs and spaces. I can convert them all to spaces then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
M-x untabify is now done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked and there are only 5 tabs right now. Feel free to convert them to spaces or to leave them alone, as long as you don't add any it's fine by me.
d7cd418 to
524f9f9
Compare
524f9f9 to
8651092
Compare
paulstelian97
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modulo that one comment this looks good (and I can live with that one too).
tools/testbench/common_test.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it may be a int32 usage, no need int64.
https://elixir.bootlin.com/zephyr/v1.7.0-rc2/source/drivers/timer/xtensa_sys_timer.c#L41
int32 should be enough, max should be set to: 400,000?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep this as 64 bits. With 400 MHz 32 bit counter overflows at 10.7s. Other Xtensas can be over 1 GHz clocked and we can support also other processor simulators too in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cycle should be a wrap data, once it go to max, then will go back to zero, so there is another issue with the code,
please refer below:
if (cycles1 > cycles0)
diff = cycles1 - cycles0;
else
diff = UINT32_MAX - cycles0 + cycles1;
it is not a always increase data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so there is another issue with the code,
What was the first issue?
cycle should be a wrap data, once it go to max, then will go back to zero,
Yes and that's OK because unsigned integers (unlike signed integers) are guaranteed to wrap around by the C standard
import numpy as np
np.uint32(5) - np.uint32(0xffffffff)
6There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int32 should be ok, since it is delta between one module. no way to exceed int32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's true a single file copy should not consume over 32 bit worth of cycles but having this 64 bits avoid type casts. The overhead from this is small and it makes this more future proof, so I'd keep it as is. Unless you or others really want me to change this to smaller size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand this code will only ever run on a GHz 64bits CPU so I don't see what difference 32 bits would make.
Mixing signed and unsigned is fraught with peril and signed overflow is undefined so unsigned is clearly better here.
kv2019i
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @singalsu !
This patch avoids the build errors. Most of the issues are from different types for formatted printing in gcc vs. xt-xcc. The "__attribute__ ((fallthrough));" is not supported in xt-xcc. The xtensa C library does not have clock_gettime() so it is only left out from build. The cycles count and MCPS is printed instead. The include of dlfcn.h is not needed since the testbench no more has dynamic libraries. Structs within structs need to be initialized to zero in xt-xcc with multiple brackets. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds to rebuild-testbench option -x <platform> that can be used to build testbench for xt-run execution. The enhanced script reuses native testbench build but with CC, LD, LDFLAGS, etc. defines to use the xt-xcc compiler for build. Currently TGL (HiFi3) is the only supported platform. More will be added later. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds to process_test() sixth argument to run the tests with xt-run environment with argument set to 'xt-run' or 'xt-run --turbo'. The set and print of LD_LIBRARY_PATH is no more needed with static testbench version. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
No script changes, just unify shell script style to be with indents with spaces instead of both tabs and spaces. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
8651092 to
acdc21f
Compare
|
I just rebased this PR and added a commit with only tabs to spaces changes to comp_run.sh. |
|
Style checkpatch warning relates to long string literals -> this is ok One unrelated fail in https://sof-ci.01.org/sofpr/PR6513/build6991/devicetest/index.html Proceeding with merge. |
Now ready. see commit texts for description.