comaniac commented on a change in pull request #9544:
URL: https://github.com/apache/tvm/pull/9544#discussion_r755661628
##########
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:
I see...Although I feel the default should be a more reasonable `arch`,
it's also fine to follow the existing one.
--
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]