gemini-code-assist[bot] commented on code in PR #18409:
URL: https://github.com/apache/tvm/pull/18409#discussion_r2478936087


##########
include/tvm/meta_schedule/database.h:
##########
@@ -31,6 +31,7 @@
 #include <tvm/tir/schedule/schedule.h>
 #include <tvm/tir/schedule/trace.h>
 
+#include <filesystem>

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   To improve code organization and dependency management, it's better to 
include `<filesystem>` directly in `src/relax/transform/meta_schedule.cc` where 
it's used, rather than in this public header file. This avoids unnecessarily 
including it for all consumers of `database.h` and makes dependencies clearer.



##########
src/relax/transform/meta_schedule.cc:
##########
@@ -86,6 +86,7 @@ Pass MetaScheduleApplyDatabase(ffi::Optional<ffi::String> 
work_dir, bool enable_
       database = Database::Current().value();
     } else {
       ICHECK(work_dir.has_value());
+      std::filesystem::create_directory(work_dir.value().c_str());

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   This is a good fix for the reported issue. For better robustness, consider 
using `std::filesystem::create_directories` instead of `create_directory`. 
`create_directories` can create parent directories if they don't exist (e.g., 
if `work_dir` is a nested path like `a/b/c`) and it doesn't produce an error if 
the directory already exists.
   
   ```suggestion
         std::filesystem::create_directories(work_dir.value().c_str());
   ```



-- 
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]

Reply via email to