Error "Unresolved intrinsic atomic_add" occurs when deploying SSD on OpenCL

I run the tutorial " Deploy Single Shot Multibox Detector(SSD) model"(https://tvm.apache.org/docs/tutorials/frontend/deploy_ssd_gluoncv.html#sphx-glr-tutorials-frontend-deploy-ssd-gluoncv-py) using the TVM committing on 2020/4/28. The default ctx_list in the .py file is (‘llvm’, cpu(0)), and the result is correct.

When I manually set the ctx_list as (‘opencl’, opencl(0)), an error occurs as follows:

Traceback (most recent call last):

  File "example.py", line 114, in <module>
    graph, lib, params = build(target)

  File "example.py", line 95, in build
    graph, lib, params = relay.build(mod, target, params=params)

  File "/home/aquapapaya/workshop/0428/incubator-tvm/python/tvm/relay/build_module.py", line 251, in build
    graph_json, mod, params = bld_mod.build(mod, target, target_host, params)

  File "/home/aquapapaya/workshop/0428/incubator-tvm/python/tvm/relay/build_module.py", line 120, in build
    self._build(mod, target, target_host)

  File "/home/aquapapaya/workshop/0428/incubator-tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 219, in __call__
    raise get_last_ffi_error()

tvm._ffi.base.TVMError: Traceback (most recent call last):
  [bt] (8) /home/aquapapaya/workshop/0428/incubator-tvm/build/libtvm.so(tvm::codegen::CodeGenC::VisitStmt_(tvm::tir::IfThenElseNode const*)+0xbe) [0x7f619edd289e]
  [bt] (7) /home/aquapapaya/workshop/0428/incubator-tvm/build/libtvm.so(tvm::NodeFunctor<void (tvm::runtime::ObjectRef const&, tvm::tir::StmtFunctor<void (tvm::tir::Stmt const&)>*)>::operator()(tvm::runtime::ObjectRef const&, tvm::tir::StmtFunctor<void (tvm::tir::Stmt const&)>*) const+0x54) [0x7f619ea67c84]
  [bt] (6) /home/aquapapaya/workshop/0428/incubator-tvm/build/libtvm.so(tvm::codegen::CodeGenC::VisitStmt_(tvm::tir::SeqStmtNode const*)+0x6e) [0x7f619edcb7ee]
  [bt] (5) /home/aquapapaya/workshop/0428/incubator-tvm/build/libtvm.so(tvm::NodeFunctor<void (tvm::runtime::ObjectRef const&, tvm::tir::StmtFunctor<void (tvm::tir::Stmt const&)>*)>::operator()(tvm::runtime::ObjectRef const&, tvm::tir::StmtFunctor<void (tvm::tir::Stmt const&)>*) const+0x54) [0x7f619ea67c84]
  [bt] (4) /home/aquapapaya/workshop/0428/incubator-tvm/build/libtvm.so(tvm::codegen::CodeGenC::VisitStmt_(tvm::tir::StoreNode const*)+0x3db) [0x7f619edd392b]
  [bt] (3) /home/aquapapaya/workshop/0428/incubator-tvm/build/libtvm.so(tvm::codegen::CodeGenC::PrintExpr[abi:cxx11](tvm::PrimExpr const&)+0x47) [0x7f619eddd997]
  [bt] (2) /home/aquapapaya/workshop/0428/incubator-tvm/build/libtvm.so(tvm::codegen::CodeGenC::PrintExpr(tvm::PrimExpr const&, std::ostream&)+0xaf) [0x7f619edce2ef]
  [bt] (1) /home/aquapapaya/workshop/0428/incubator-tvm/build/libtvm.so(tvm::codegen::CodeGenC::VisitExpr_(tvm::tir::CallNode const*, std::ostream&)+0x87) [0x7f619edd54f7]
  [bt] (0) /home/aquapapaya/workshop/0428/incubator-tvm/build/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x7c) [0x7f619e97362c]
  File "/home/aquapapaya/workshop/0428/incubator-tvm/src/target/source/codegen_c.cc", line 627
TVMError: Unresolved intrinsic atomic_add with return type int32

To reproduce the error, you can run: https://github.com/aquapapaya/InstallTVM/blob/master/example.py

The .params file can be obtained from: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/models/ssd_512_resnet50_v1_voc-9c8b225a.zip

The problem has been solved with the PR: https://github.com/apache/incubator-tvm/pull/5857

Thanks TVM community!