comaniac commented on a change in pull request #9544:
URL: https://github.com/apache/tvm/pull/9544#discussion_r755622053
##########
File path: python/tvm/target/target.py
##########
@@ -228,7 +235,7 @@ def _merge_opts(opts, new_opts):
return opts
-def cuda(model="unknown", options=None):
+def cuda(model="unknown", arch=None, options=None):
Review comment:
docstring
##########
File path: src/target/target_kind.cc
##########
@@ -143,6 +143,33 @@ void CheckOrSetAttr(Map<String, ObjectRef>* attrs, const
String& name, const Str
/********** Target kind attribute updaters **********/
+/*!
+ * \brief Update the attributes in the CUDA target.
+ * \param attrs The original attributes
+ * \return The updated attributes
+ */
+Map<String, ObjectRef> UpdateCUDAAttrs(Map<String, ObjectRef> attrs) {
+ // Update -arch=sm_xx
+ int archInt;
+ if (attrs.count("arch")) {
+ // If -arch has been specified, validate the correctness
+ String archStr = Downcast<String>(attrs.at("arch"));
+ archInt = ExtractIntWithPrefix(archStr, "sm_");
+ ICHECK(archInt != -1) << "ValueError: CUDA target gets an invalid CUDA
arch: -arch=" << archStr;
+ } else {
+ // Use the compute version of the first CUDA GPU instead
+ TVMRetValue version;
+ if (!DetectDeviceFlag({kDLCUDA, 0}, runtime::kComputeVersion, &version)) {
+ LOG(WARNING) << "Unable to detect CUDA version, default to
\"-arch=sm_20\" instead";
+ archInt = 20;
Review comment:
Our of curiosity, why sm_20?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]