areusch commented on code in PR #12140: URL: https://github.com/apache/tvm/pull/12140#discussion_r931657833
########## src/target/llvm/llvm_scope.cc: ########## @@ -0,0 +1,368 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#ifdef TVM_LLVM_VERSION + +#include "llvm_scope.h" + +#include <dmlc/base.h> +#include <llvm/ADT/ArrayRef.h> +#include <llvm/ADT/StringRef.h> +#if TVM_LLVM_VERSION >= 150 +#include <llvm/IR/FMF.h> +#else +#include <llvm/IR/Operator.h> +#endif +#include <llvm/IR/LLVMContext.h> +#include <llvm/IR/Metadata.h> +#include <llvm/IR/Module.h> +#include <llvm/IRReader/IRReader.h> +#if TVM_LLVM_VERSION >= 140 +#include <llvm/MC/TargetRegistry.h> +#else +#include <llvm/Support/TargetRegistry.h> +#endif +#include <llvm/Support/CodeGen.h> +#include <llvm/Support/ErrorOr.h> +#include <llvm/Support/Host.h> +#include <llvm/Support/MemoryBuffer.h> +#include <llvm/Support/SourceMgr.h> +#include <llvm/Support/TargetSelect.h> +#include <llvm/Support/raw_ostream.h> +#include <llvm/Target/TargetMachine.h> +#include <llvm/Target/TargetOptions.h> +#include <tvm/runtime/container/array.h> +#include <tvm/runtime/container/map.h> +#include <tvm/runtime/container/optional.h> +#include <tvm/runtime/container/string.h> +#include <tvm/runtime/logging.h> +#include <tvm/runtime/object.h> +#include <tvm/target/target.h> + +#include <atomic> +#include <sstream> +#include <string> +#include <system_error> + +namespace tvm { +namespace codegen { + +namespace { +namespace defaults { +static const std::string cpu = "generic"; // NOLINT(runtime/string) Review Comment: that's fair--i think at global scope the concern is that strings are mutable and live in .data. should we adopt the `const char*` convention here to avoid those pitfalls? -- 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: commits-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org