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

[ROCM] Working math function support for ROCm backend, a bug fix in LLVM based codegen #570

Merged
merged 3 commits into from
Oct 20, 2017
Merged

Conversation

masahi
Copy link
Member

@masahi masahi commented Oct 20, 2017

This PR adds working math function support to ROCm backend. It supersedes #553.
It also fixes a bug in external function call generator in LLVM based codegen.

With this PR, we can pass test_topi_softmax.py and test_topi_reduce.py.
It also enables running resnet and mobilenet benchmark in nnvm.

Resnet18 and mobilenet benchmark, on R9 Nano

$ python cuda_imagenet_bench.py --model resnet
benchmark args: Namespace(model='resnet', num_iter=1000, opt_level=1)
ProfileResult(mean=0.010514197691)
ProfileResult(mean=0.010503243036)
ProfileResult(mean=0.01050078192)
$ python cuda_imagenet_bench.py --model mobilenet
benchmark args: Namespace(model='mobilenet', num_iter=1000, opt_level=1)
ProfileResult(mean=0.005886083819)
ProfileResult(mean=0.005881836798)
ProfileResult(mean=0.005873367036000001)

@masahi
Copy link
Member Author

masahi commented Oct 20, 2017

cc @adityaatluri

@masahi masahi changed the title Working math function support for ROCm backend, a bug fix in LLVM based codegen [ROCM] Working math function support for ROCm backend, a bug fix in LLVM based codegen Oct 20, 2017
lint fix

fix build

bug fix extern func call in llvm based codegen
using namespace ir;
const Call* call = e.as<Call>();
CHECK(call != nullptr);
const std::string bit_width = std::to_string(call->type.bits());
Copy link
Member

Choose a reason for hiding this comment

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

it might be easier to use std::ostringstream to construct the string

Copy link
Member

Choose a reason for hiding this comment

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

specifically use

std::ostringstream intrin_name;

intrin_name << "__ocml_" << call->name << "_f" << call->type.bits();
// use intrin_name.str()

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, it is fixed

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.

2 participants