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

[CODEGEN][AOCL] Add math intrinsic rules #1653

Merged
merged 4 commits into from
Aug 25, 2018

Conversation

kazum
Copy link
Contributor

@kazum kazum commented Aug 24, 2018

This PR adds math intrinsic rules for AOCL.

In addition, to simplify an AOCL target name for emulation, I made the -device parameter of the AOCL target optional.

@kazum
Copy link
Contributor Author

kazum commented Aug 24, 2018

@tmoreau89 @nishi-t @Ktabata Can you review this PR?

@oss-dev-somewhere
Copy link
Contributor

Removing target device name looks good to me.
'aoc' uses 'AOCL_BOARD_PACKAGE_ROOT' environment variable to determine the board name when '-board=' is not specified.

Copy link
Contributor

@oss-dev-somewhere oss-dev-somewhere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'aoc' uses 'AOCL_BOARD_PACKAGE_ROOT' environment variable to determine the board name when '-board=' is not specified.

for (std::string option : target->options()) {
if (option == "-mattr=emulator") {
cmd += " -march=emulator";
}
}
cmd += " -board=" + target->device_name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works on my machine.

@@ -39,7 +39,8 @@ def check_device(device):
foo(a, b)
np.testing.assert_allclose(b.asnumpy(), b_np, rtol=1e-5, atol=1e-5)

for device in ['cuda', 'opencl', 'metal', 'rocm', 'vulkan', 'llvm', 'nvptx', 'sdaccel']:
for device in ['cuda', 'opencl', 'metal', 'rocm', 'vulkan', 'llvm', 'nvptx', 'sdaccel',
'aocl -mattr=emulator']:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to rename the device string to a something like aocl_emu? keeping in mind that there are different forms of emulation (sw vs. hw)

@tmoreau89
Copy link
Contributor

Overall the changes look good. My only question touches on the way we pass the emulation attribute to the AOCL code gen backend. One way is to use a target option as we do, but another would be to simply add another target string like aocl_emu which makes it easier to parse targets strings.

@kazum
Copy link
Contributor Author

kazum commented Aug 24, 2018

@tmoreau89 Thanks for your comment. Adding a target string for emulation sounds good to me. I've pushed a commit for that, can you check it out?

@tmoreau89
Copy link
Contributor

thank you, I think having an emulation target makes sense in this context. Does the aocl support different types of emulation (sw vs. hw as with sdaccel)?

@kazum
Copy link
Contributor Author

kazum commented Aug 24, 2018

@tmoreau89 AFAIK, AOCL supports only software emulation. No need to care about different kind of emulation.

Copy link
Contributor

@nishi-t nishi-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kazum Could you fix the aocl document in accordance with the change?
https://github.com/dmlc/tvm/blob/master/docs/deploy/aocl_fpga.md
-mattr=emulator will be invalid

@nishi-t
Copy link
Contributor

nishi-t commented Aug 24, 2018

If we will support different emulation types for sdaccel by naming (e.g. sdaccel_sw_emu, sdaccel_hw_emu) in the future, using consistent name(e.g. aocl_sw_emu) may be good for users. But this may be matter of taste :)

@tmoreau89
Copy link
Contributor

indeed some folks might care about the distinction between hardware and software emulation, therefore it might be good to explicitly specify it since sdaccel offers both modes (to avoid any ambiguity). Since execution time can vary by 1-2 orders of magnitude from software to hardware emulation, it'll be good to have explicit control by changing the target name.

@kazum
Copy link
Contributor Author

kazum commented Aug 24, 2018

@tmoreau89 @nishi-t Thanks, I’ve addressed your comments. I think of introducing sdaccel_sw_emu and sdaccel_hw_emu in a future PR, too. :)

@tqchen tqchen added the status: need update need update based on feedbacks label Aug 25, 2018
Copy link
Contributor

@nishi-t nishi-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kazum LGTM. Thanks

@tmoreau89
Copy link
Contributor

LGTM

@tmoreau89 tmoreau89 merged commit a03c60b into apache:master Aug 25, 2018
ZhennanQin pushed a commit to ZhennanQin/tvm that referenced this pull request Sep 6, 2018
* [CODEGEN][AOCL] Add math intrinsic rules

* introduce aocl_emu target for AOCL emulation

* rename aocl_emu with aocl_sw_emu

* update docs
FrozenGene pushed a commit to FrozenGene/tvm that referenced this pull request Dec 27, 2018
* [CODEGEN][AOCL] Add math intrinsic rules

* introduce aocl_emu target for AOCL emulation

* rename aocl_emu with aocl_sw_emu

* update docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: need update need update based on feedbacks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants