Skip to content

Conversation

@rascani
Copy link
Contributor

@rascani rascani commented Jul 15, 2023

The generic benchmarking utilities added in PR 2125 did not compile on RISC-V due to two separate issues:

  • An incorrect format specifier for int32_t on RISC-V. This is resolved by using PRId32 instead of %ld or %d.
  • The fileno() is undeclared with the RISC-V toolchain, similar to how it is with the Embedded ARM toolchain. This PR resolves this by forgoing the fstat() check on file size (as this is what used fileno), and instead attempting to read the maximum number of bytes we can fit in the model buffer. We can then use feof() to verify that we read the entirety of the model, and error out if we did not. This solution also eliminates needing to worry about different file types, such as how the Xtensa simulator treats files from the host system as character devices.

BUG=2129

The generic benchmarking utilities added in PR 2125 did not compile on
RISC-V due to two separate issues:

 * An incorrect format specifier for int32_t on RISC-V. This is resolved
   by using PRId32 instead of %ld or %d.
 * The fileno() is undeclared with the RISC-V toolchain, similar to how
   it is with the Embedded ARM toolchain. This PR resolves this by
   forgoing the fstat() check on file size (as this is what used
   fileno), and instead attempting to read the maximum number of bytes
   we can fit in the model buffer. We can then use feof() to verify that
   we read the entirety of the model, and error out if we did not. This
   solution also eliminates needing to worry about different file types,
   such as how the Xtensa simulator treats files from the host system as
   character devices.

BUG=2129
@rascani rascani requested a review from a team as a code owner July 15, 2023 00:40
@mergify mergify bot merged commit 52007f6 into tensorflow:main Jul 15, 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