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

[TOPI] Bitserial low-precision convolution #1332

Merged
merged 16 commits into from
Jul 23, 2018
Merged

Conversation

cowanmeg
Copy link
Contributor

Bitserial low-precision convolution operators for x86 and raspberry pi
Raspberry pi schedules include optimized microkernel

@cowanmeg cowanmeg changed the title Bitserial low-precision convolution [TOPI] Bitserial low-precision convolution Jun 25, 2018
@tqchen
Copy link
Member

tqchen commented Jun 25, 2018

please remove change in the submodule and update to the lastest one

@@ -53,6 +53,22 @@ def schedule_conv2d_nhwc(outs):
"""
return _default_schedule(outs, False)

@tvm.target.generic_func
def schedule_qdense(outs):
Copy link
Member

Choose a reason for hiding this comment

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

qdense->bitserial_dense?

def _intrin_func(ins, outs):
ww, xx = ins
zz = outs[0]
vpadd_id = tvm.const(647, 'uint32')
Copy link
Member

Choose a reason for hiding this comment

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

Did we develop an intrinsic id query function by name? since this may differ in llvm version

@tqchen
Copy link
Member

tqchen commented Jun 25, 2018

Some actionable items to improve the intrinsic id finding

  • Use Intrinsic::ID Function::lookupIntrinsicID to lookup intrinsic ID by name
  • Register PackedFunction codegen.llvm_lookup_intrinsic_id(name: str) -> id: int
  • Add the implementation in intrin.py
    • call_llvm_intrin, with the intrinsic name as the first argument, which looks up things by name, and then uses call extern


@tvm.target.generic_func
def schedule_bitserial_conv2d_nhwc(outs):
"""Schedule for qconv2d_nhwc
Copy link
Member

Choose a reason for hiding this comment

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

qconv2d -> bitserial, maybe try to do a search for qconv2d and rename

func(a, w, b)
np.testing.assert_allclose(b.asnumpy(), b_np, rtol=1e-5)

def test_bitserial_conv2d():
Copy link
Member

Choose a reason for hiding this comment

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

Since there is a specialization path for ARM, let us add a testcase up to codegen(but not actually run the code) and quickly checking we have the intrinsic we need

@@ -53,6 +53,22 @@ def schedule_conv2d_nhwc(outs):
"""
return _default_schedule(outs, False)

@tvm.target.generic_func
def schedule_qdense(outs):
Copy link
Member

Choose a reason for hiding this comment

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

qdense->bitserial_dense

@@ -143,6 +159,41 @@ def schedule_depthwise_conv2d_nhwc(outs):
"""
return _default_schedule(outs, False)

@tvm.target.generic_func
def schedule_bitserial_conv2d_nchw(outs):
"""Schedule for qconv2d_nchw
Copy link
Member

Choose a reason for hiding this comment

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

qconv2d->bitserial_conv2d, do a search over qconv2d and replace by bitserial_conv2d

@tqchen tqchen added status: review in progress status: need update need update based on feedbacks labels Jul 17, 2018
@tqchen
Copy link
Member

tqchen commented Jul 21, 2018

please followup with the naming change and llvm intrinsic id query function

@tqchen tqchen merged commit 2d36f61 into apache:master Jul 23, 2018
@tqchen
Copy link
Member

tqchen commented Jul 23, 2018

Thanks @cowanmeg for improving the PR! this is now merged

@tqchen tqchen removed status: need update need update based on feedbacks status: review in progress labels Jul 23, 2018
tqchen pushed a commit to tqchen/tvm that referenced this pull request Aug 4, 2018
sergei-mironov pushed a commit to sergei-mironov/tvm that referenced this pull request Aug 8, 2018
@cowanmeg cowanmeg deleted the lowprec-ops branch April 5, 2019 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants