"configs/datasets/vscode:/vscode.git/clone" did not exist on "e9cdb24dddde3419ae490a649cff9d79947ed45c"
Unverified Commit f28a62ea authored by Paul Fultz II's avatar Paul Fultz II Committed by GitHub
Browse files

Add hip clang builds to jenkins (#651)

* Make global variables const

* Tidy fixes

* Disable some lints

* Formatting

* Fix tidy const

* Formatting

* Add missing const keywords

* Formatting

* More fixes

* Fix remaining tidy issues

* Formatting

* Fix rocblas function call

* Formatting

* Fix nodiscard warnings

* Formatting

* Use named parameters

* Remove overload

* Add overload

* Remove noncps

* Use named param for node

* Add auto register header

* Use named parameters

* Refactor jenkinsfile

* Fix shadow

* Add missing body variable

* Add more const methods

* Add hip-clang docker builds

* Remove comments

* Add clang-format

* Add more const

* Formatting

* Rename stage

* Disable check

* Add another const

* Add python 2 dev packages

* Add sphinx to dockerfile
parent 48fa934d
CheckOptions: CheckOptions:
- key: bugprone-reserved-identifier.AllowedIdentifiers
value: '__HIP_PLATFORM_HCC__;__HIP_ROCclr__'
- key: bugprone-unused-return-value.CheckedFunctions - key: bugprone-unused-return-value.CheckedFunctions
value: '::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique;::std::unique_ptr::release;::std::basic_string::empty;::std::vector::empty;::std::find;::std::find_if;::std::find_if_not;::std::all_of;::std::any_of;::std::none_of;::std::count;::std::count_if;::std::mismatch;::std::find_end;::std::find_first_of;::std::adjacent_find;::std::search;::std::search_n;::std::nth_element;::std::lower_bound;::std::upper_bound;::std::binary_search;::std::equal_range;::std::max;::std::max_element;::std::min;::std::min_element;::std::minmax;::std::minmax_element;::std::equal;::std::lexicographical_compare;::std::accumulate;::std::inner_product' value: '::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique;::std::unique_ptr::release;::std::basic_string::empty;::std::vector::empty;::std::find;::std::find_if;::std::find_if_not;::std::all_of;::std::any_of;::std::none_of;::std::count;::std::count_if;::std::mismatch;::std::find_end;::std::find_first_of;::std::adjacent_find;::std::search;::std::search_n;::std::nth_element;::std::lower_bound;::std::upper_bound;::std::binary_search;::std::equal_range;::std::max;::std::max_element;::std::min;::std::min_element;::std::minmax;::std::minmax_element;::std::equal;::std::lexicographical_compare;::std::accumulate;::std::inner_product'
- key: cppcoreguidelines-macro-usage.AllowedRegexp - key: cppcoreguidelines-macro-usage.AllowedRegexp
value: 'DEBUG|FALLTHROUGH|_THROW|_REQUIRES|_DECLARE_|_VISIT_|_REGISTER_|_GENERATE_|_DETAIL_|_MANAGE_PTR|_MATCHER|DEVICE_SHARED' value: 'DEBUG|FALLTHROUGH|_THROW|_REQUIRES|_DECLARE_|_VISIT_|_REGISTER_|_GENERATE_|_DETAIL_|_TIDY_|_MANAGE_PTR|_MATCHER|DEVICE_SHARED'
- key: cppcoreguidelines-narrowing-conversions.WarnOnFloatingPointNarrowingConversion - key: cppcoreguidelines-narrowing-conversions.WarnOnFloatingPointNarrowingConversion
value: 0 value: 0
- key: modernize-loop-convert.MinConfidence - key: modernize-loop-convert.MinConfidence
......
...@@ -70,6 +70,10 @@ rocm_enable_clang_tidy( ...@@ -70,6 +70,10 @@ rocm_enable_clang_tidy(
modernize-* modernize-*
performance-* performance-*
readability-* readability-*
-bugprone-signed-char-misuse
# Disable the aliased reserved identifiers
-cert-dcl37-c
-cert-dcl51-cpp
# Disable all alpha checks by default # Disable all alpha checks by default
-clang-analyzer-alpha* -clang-analyzer-alpha*
# Enable some alpha checks # Enable some alpha checks
...@@ -102,6 +106,7 @@ rocm_enable_clang_tidy( ...@@ -102,6 +106,7 @@ rocm_enable_clang_tidy(
-google-runtime-int -google-runtime-int
-google-runtime-references -google-runtime-references
-misc-macro-parentheses -misc-macro-parentheses
-misc-no-recursion
-modernize-concat-nested-namespaces -modernize-concat-nested-namespaces
-modernize-pass-by-value -modernize-pass-by-value
-modernize-use-default-member-init -modernize-use-default-member-init
...@@ -114,7 +119,8 @@ rocm_enable_clang_tidy( ...@@ -114,7 +119,8 @@ rocm_enable_clang_tidy(
-readability-convert-member-functions-to-static -readability-convert-member-functions-to-static
-readability-else-after-return -readability-else-after-return
-readability-named-parameter -readability-named-parameter
-readability-uppercase-literal-suffix, -readability-redundant-string-init
-readability-uppercase-literal-suffix
-*-avoid-c-arrays -*-avoid-c-arrays
-*-explicit-constructor -*-explicit-constructor
-*-magic-numbers -*-magic-numbers
......
def rocmtestnode(variant, name, body, args, pre) { // def rocmtestnode(variant, name, body, args, pre) {
def rocmtestnode(Map conf) {
def variant = conf.get("variant")
def name = conf.get("node")
def body = conf.get("body")
def docker_args = conf.get("docker_args", "")
def docker_build_args = conf.get("docker_build_args", "")
def pre = conf.get("pre", {})
def image = 'migraphxlib' def image = 'migraphxlib'
def cmake_build = { compiler, flags -> def cmake_build = { compiler, flags ->
def cmd = """ def cmd = """
...@@ -28,13 +35,13 @@ def rocmtestnode(variant, name, body, args, pre) { ...@@ -28,13 +35,13 @@ def rocmtestnode(variant, name, body, args, pre) {
pre() pre()
stage("image ${variant}") { stage("image ${variant}") {
try { try {
docker.build("${image}", '.') docker.build("${image}", "${docker_build_args} .")
} catch(Exception ex) { } catch(Exception ex) {
docker.build("${image}", '--no-cache .') docker.build("${image}", "${docker_build_args} --no-cache .")
} }
} }
withDockerContainer(image: image, args: "--device=/dev/kfd --device=/dev/dri --group-add video --cap-add SYS_PTRACE ${args}") { withDockerContainer(image: image, args: "--device=/dev/kfd --device=/dev/dri --group-add video --cap-add SYS_PTRACE ${docker_args}") {
timeout(time: 1, unit: 'HOURS') { timeout(time: 1, unit: 'HOURS') {
body(cmake_build) body(cmake_build)
} }
...@@ -42,7 +49,6 @@ def rocmtestnode(variant, name, body, args, pre) { ...@@ -42,7 +49,6 @@ def rocmtestnode(variant, name, body, args, pre) {
} }
} }
} }
// @NonCPS
def rocmtest(m) { def rocmtest(m) {
def builders = [:] def builders = [:]
m.each { e -> m.each { e ->
...@@ -55,8 +61,7 @@ def rocmtest(m) { ...@@ -55,8 +61,7 @@ def rocmtest(m) {
parallel builders parallel builders
} }
// @NonCPS def rocmnodename(name) {
def rocmnode(name, args, pre, body) {
def node_name = 'rocmtest || rocm' def node_name = 'rocmtest || rocm'
if(name == 'fiji') { if(name == 'fiji') {
node_name = 'rocmtest && fiji'; node_name = 'rocmtest && fiji';
...@@ -65,18 +70,19 @@ def rocmnode(name, args, pre, body) { ...@@ -65,18 +70,19 @@ def rocmnode(name, args, pre, body) {
} else { } else {
node_name = name node_name = name
} }
return { label -> return node_name
rocmtestnode(label, node_name, body, args, pre)
}
} }
def rocmnode(name, body) { def rocmnode(name, body) {
rocmnode(name, '', {}, body) return { label ->
rocmtestnode(variant: label, node: rocmnodename(name), body: body)
}
} }
// @NonCPS def rocmhipclangnode(name, body) {
def rocmnode(body) { return { label ->
rocmnode('rocmtest', '', {}, body) rocmtestnode(variant: label, node: rocmnodename(name), docker_build_args: '-f hip-clang.docker', body: body)
}
} }
// Static checks // Static checks
...@@ -123,6 +129,21 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build -> ...@@ -123,6 +129,21 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build ->
stage('Clang Release Python 3') { stage('Clang Release Python 3') {
cmake_build("hcc", "-DCMAKE_BUILD_TYPE=release -DPYTHON_EXECUTABLE=/usr/local/bin/python3") cmake_build("hcc", "-DCMAKE_BUILD_TYPE=release -DPYTHON_EXECUTABLE=/usr/local/bin/python3")
} }
}, hip_clang_release: rocmhipclangnode('vega') { cmake_build ->
stage('Hip Clang Release') {
cmake_build("/opt/rocm/llvm/bin/clang++", "-DCMAKE_BUILD_TYPE=release")
// stash includes: 'build/*.deb', name: 'migraphx-package'
}
}, hip_clang_tidy: rocmhipclangnode('rocmtest') { cmake_build ->
stage('Hip Clang Tidy') {
sh '''
rm -rf build
mkdir build
cd build
CXX=/opt/rocm/llvm/bin/clang++ cmake ..
make -j$(nproc) -k analyze
'''
}
}, gcc5: rocmnode('rocmtest') { cmake_build -> }, gcc5: rocmnode('rocmtest') { cmake_build ->
stage('GCC 5 Debug') { stage('GCC 5 Debug') {
cmake_build("g++-5", "-DCMAKE_BUILD_TYPE=debug") cmake_build("g++-5", "-DCMAKE_BUILD_TYPE=debug")
...@@ -153,10 +174,16 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build -> ...@@ -153,10 +174,16 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build ->
} }
} }
rocmtest onnx: rocmnode('rocmtest', '-u root', { def onnxnode(name, body) {
sh 'rm -rf ./build/*.deb' return { label ->
unstash 'migraphx-package' rocmtestnode(variant: label, node: rocmnodename(name), docker_args: '-u root', body: body, pre: {
}) { cmake_build -> sh 'rm -rf ./build/*.deb'
unstash 'migraphx-package'
})
}
}
rocmtest onnx: onnxnode('rocmtest') { cmake_build ->
stage("Onnx runtime") { stage("Onnx runtime") {
sh ''' sh '''
ls -lR ls -lR
......
FROM ubuntu:18.04
ARG PREFIX=/usr/local
# Support multiarch
RUN dpkg --add-architecture i386
# Add rocm repository
RUN sh -c 'echo deb [arch=amd64 trusted=yes] http://repo.radeon.com/rocm/apt/.apt_3.7/ xenial main > /etc/apt/sources.list.d/rocm.list'
# Install dependencies
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
apt-utils \
build-essential \
clang-format-5.0 \
cmake \
curl \
doxygen \
gdb \
git \
lcov \
pkg-config \
python \
python-dev \
python-pip \
python3 \
python3-dev \
python3-pip \
software-properties-common \
wget \
rocm-device-libs \
miopen-hip \
rocblas \
zlib1g-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Workaround broken rocm packages
RUN ln -s /opt/rocm-* /opt/rocm
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# Install rbuild
RUN pip3 install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
# Install doc requirements
ADD doc/requirements.txt /doc-requirements.txt
RUN pip3 install -r /doc-requirements.txt
# Install dependencies
ADD dev-requirements.txt /dev-requirements.txt
ADD requirements.txt /requirements.txt
RUN rbuild prepare --cxx /opt/rocm/llvm/bin/clang++ -d $PREFIX -S /
# Install rocm-cmake
RUN cget -p $PREFIX install -U RadeonOpenCompute/rocm-cmake@master
...@@ -17,6 +17,7 @@ inline namespace MIGRAPHX_INLINE_NS { ...@@ -17,6 +17,7 @@ inline namespace MIGRAPHX_INLINE_NS {
inline auto& get_commands() inline auto& get_commands()
{ {
// NOLINTNEXTLINE
static std::unordered_map<std::string, std::function<void(std::vector<std::string> args)>> m; static std::unordered_map<std::string, std::function<void(std::vector<std::string> args)>> m;
return m; return m;
} }
...@@ -64,7 +65,7 @@ int auto_register_command() ...@@ -64,7 +65,7 @@ int auto_register_command()
template <class T> template <class T>
struct command struct command
{ {
static int static_register; static const int static_register;
// This typedef ensures that the static member will be instantiated if // This typedef ensures that the static member will be instantiated if
// the class itself is instantiated // the class itself is instantiated
using static_register_type = using static_register_type =
...@@ -77,7 +78,7 @@ struct command ...@@ -77,7 +78,7 @@ struct command
#endif #endif
template <class T> template <class T>
int command<T>::static_register = auto_register_command<T>(); // NOLINT const int command<T>::static_register = auto_register_command<T>(); // NOLINT
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace driver } // namespace driver
......
...@@ -159,7 +159,7 @@ struct loader ...@@ -159,7 +159,7 @@ struct loader
os.write(buffer.data(), buffer.size()); os.write(buffer.data(), buffer.size());
} }
void save(const program& p) void save(const program& p) const
{ {
auto* os = &std::cout; auto* os = &std::cout;
std::ofstream fs; std::ofstream fs;
......
...@@ -31,7 +31,7 @@ std::size_t value_of(const char* name, std::size_t fallback) ...@@ -31,7 +31,7 @@ std::size_t value_of(const char* name, std::size_t fallback)
std::vector<std::string> env(const char* name) std::vector<std::string> env(const char* name)
{ {
auto p = std::getenv(name); auto* p = std::getenv(name);
if(p == nullptr) if(p == nullptr)
return {}; return {};
else else
......
...@@ -17,7 +17,7 @@ int auto_register_action() ...@@ -17,7 +17,7 @@ int auto_register_action()
template <class Action, class T> template <class Action, class T>
struct auto_register struct auto_register
{ {
static int static_register; const static int static_register;
// This typedef ensures that the static member will be instantiated if // This typedef ensures that the static member will be instantiated if
// the class itself is instantiated // the class itself is instantiated
using static_register_type = using static_register_type =
...@@ -30,7 +30,7 @@ struct auto_register ...@@ -30,7 +30,7 @@ struct auto_register
#endif #endif
template <class Action, class T> template <class Action, class T>
int auto_register<Action, T>::static_register = auto_register_action<Action, T>(); // NOLINT const int auto_register<Action, T>::static_register = auto_register_action<Action, T>(); // NOLINT
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic pop #pragma clang diagnostic pop
......
...@@ -188,7 +188,7 @@ struct check_shapes ...@@ -188,7 +188,7 @@ struct check_shapes
return std::all_of(begin, end, p); return std::all_of(begin, end, p);
} }
const shape* get(long i) const shape* get(long i) const
{ {
if(i >= size()) if(i >= size())
MIGRAPHX_THROW(prefix() + "Accessing shape out of bounds"); MIGRAPHX_THROW(prefix() + "Accessing shape out of bounds");
...@@ -199,9 +199,9 @@ struct check_shapes ...@@ -199,9 +199,9 @@ struct check_shapes
return begin + i; return begin + i;
} }
check_shapes slice(long start) { return {get(start), end, name}; } check_shapes slice(long start) const { return {get(start), end, name}; }
check_shapes slice(long start, long last) { return {get(start), get(last), name}; } check_shapes slice(long start, long last) const { return {get(start), get(last), name}; }
}; };
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
......
...@@ -7,6 +7,12 @@ namespace migraphx { ...@@ -7,6 +7,12 @@ namespace migraphx {
#define MIGRAPHX_INLINE_NS version_1 #define MIGRAPHX_INLINE_NS version_1
#endif #endif
#ifdef MIGRAPHX_USE_CLANG_TIDY
#define MIGRAPHX_TIDY_CONST const
#else
#define MIGRAPHX_TIDY_CONST
#endif
} // namespace migraphx } // namespace migraphx
#endif #endif
...@@ -90,7 +90,7 @@ struct literal : raw_data<literal> ...@@ -90,7 +90,7 @@ struct literal : raw_data<literal>
m_shape.visit_type([&](auto as) { m_shape.visit_type([&](auto as) {
auto output = make_view(m_shape, as.from(buffer.get())); auto output = make_view(m_shape, as.from(buffer.get()));
shape_for_each(output.get_shape(), [&](const auto& idx) { shape_for_each(output.get_shape(), [&](const auto& idx) {
output(idx.begin(), idx.end()) = *it; output(idx.begin(), idx.end()) = *it; // NOLINT(bugprone-signed-char-misuse)
it++; it++;
}); });
}); });
......
...@@ -16,7 +16,7 @@ struct manage_deleter ...@@ -16,7 +16,7 @@ struct manage_deleter
{ {
if(x != nullptr) if(x != nullptr)
{ {
f(x); (void)f(x);
} }
} }
}; };
......
...@@ -55,6 +55,7 @@ struct unary : op_name<Derived> ...@@ -55,6 +55,7 @@ struct unary : op_name<Derived>
result.visit([&](auto output) { result.visit([&](auto output) {
args[0].visit([&](auto input) { args[0].visit([&](auto input) {
shape_for_each(output.get_shape(), [&](const auto& idx) { shape_for_each(output.get_shape(), [&](const auto& idx) {
// NOLINTNEXTLINE(bugprone-signed-char-misuse)
output(idx.begin(), idx.end()) = static_cast<const Derived&>(*this).apply()( output(idx.begin(), idx.end()) = static_cast<const Derived&>(*this).apply()(
input(idx.begin(), idx.end())); input(idx.begin(), idx.end()));
}); });
......
...@@ -66,7 +66,7 @@ struct program ...@@ -66,7 +66,7 @@ struct program
} }
instruction_ref replace_instruction(instruction_ref ins, instruction_ref replace_instruction(instruction_ref ins,
const operation& op, const operation& op,
std::vector<instruction_ref> args); std::vector<instruction_ref> args) MIGRAPHX_TIDY_CONST;
instruction_ref replace_instruction(instruction_ref ins, instruction_ref rep); instruction_ref replace_instruction(instruction_ref ins, instruction_ref rep);
...@@ -141,8 +141,6 @@ struct program ...@@ -141,8 +141,6 @@ struct program
private: private:
void assign(const program& p); void assign(const program& p);
private:
std::unique_ptr<program_impl> impl; std::unique_ptr<program_impl> impl;
}; };
......
...@@ -8,30 +8,32 @@ namespace migraphx { ...@@ -8,30 +8,32 @@ namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
template <class PrivateMigraphTypeNameProbe> template <class PrivateMigraphTypeNameProbe>
const std::string& get_type_name() std::string compute_type_name()
{ {
static std::string name; std::string name;
if(name.empty())
{
#ifdef _MSC_VER #ifdef _MSC_VER
name = typeid(PrivateMigraphTypeNameProbe).name(); name = typeid(PrivateMigraphTypeNameProbe).name();
name = name.substr(7); name = name.substr(7);
#else #else
const char parameter_name[] = "PrivateMigraphTypeNameProbe ="; // NOLINT const char parameter_name[] = "PrivateMigraphTypeNameProbe ="; // NOLINT
name = __PRETTY_FUNCTION__; name = __PRETTY_FUNCTION__;
auto begin = name.find(parameter_name) + sizeof(parameter_name); auto begin = name.find(parameter_name) + sizeof(parameter_name);
#if(defined(__GNUC__) && !defined(__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7) #if(defined(__GNUC__) && !defined(__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7)
auto length = name.find_last_of(",") - begin; auto length = name.find_last_of(",") - begin;
#else #else
auto length = name.find_first_of("];", begin) - begin; auto length = name.find_first_of("];", begin) - begin;
#endif #endif
name = name.substr(begin, length); name = name.substr(begin, length);
#endif #endif
} return name;
}
template <class T>
const std::string& get_type_name()
{
static const std::string name = compute_type_name<T>();
return name; return name;
} }
......
...@@ -41,7 +41,7 @@ void value_to_json(const T& x, json& j) ...@@ -41,7 +41,7 @@ void value_to_json(const T& x, json& j)
void value_to_json(const std::vector<value>& x, json& j) void value_to_json(const std::vector<value>& x, json& j)
{ {
for(auto& v : x) for(const auto& v : x)
{ {
if(v.get_key().empty()) if(v.get_key().empty())
{ {
......
...@@ -69,7 +69,7 @@ int main(int argc, char const* argv[]) ...@@ -69,7 +69,7 @@ int main(int argc, char const* argv[])
} }
auto labels = imageset.first; auto labels = imageset.first;
auto input = imageset.second; auto input = imageset.second;
auto ptr = input.data(); auto* ptr = input.data();
for(int i = 0; i < 10; i++) for(int i = 0; i < 10; i++)
{ {
std::cout << "label: " << static_cast<uint32_t>(labels[i]) << " ----> "; std::cout << "label: " << static_cast<uint32_t>(labels[i]) << " ----> ";
...@@ -91,7 +91,7 @@ int main(int argc, char const* argv[]) ...@@ -91,7 +91,7 @@ int main(int argc, char const* argv[])
auto s = migraphx::shape{migraphx::shape::float_type, {1, 3, 32, 32}}; auto s = migraphx::shape{migraphx::shape::float_type, {1, 3, 32, 32}};
auto labels = imageset.first; auto labels = imageset.first;
auto input = imageset.second; auto input = imageset.second;
auto ptr = input.data(); auto* ptr = input.data();
for(int i = 0; i < 10; i++) for(int i = 0; i < 10; i++)
{ {
std::cout << "label: " << static_cast<uint32_t>(labels[i]) << " ----> "; std::cout << "label: " << static_cast<uint32_t>(labels[i]) << " ----> ";
......
...@@ -123,7 +123,7 @@ int main(int argc, char const* argv[]) ...@@ -123,7 +123,7 @@ int main(int argc, char const* argv[])
prog.compile(migraphx::gpu::target{}); prog.compile(migraphx::gpu::target{});
auto s = migraphx::shape{migraphx::shape::float_type, {1, 1, 28, 28}}; auto s = migraphx::shape{migraphx::shape::float_type, {1, 1, 28, 28}};
std::cout << s << std::endl; std::cout << s << std::endl;
auto ptr = input.data(); auto* ptr = input.data();
migraphx::program::parameter_map m; migraphx::program::parameter_map m;
m["output"] = m["output"] =
migraphx::gpu::to_gpu(migraphx::generate_argument(prog.get_parameter_shape("output"))); migraphx::gpu::to_gpu(migraphx::generate_argument(prog.get_parameter_shape("output")));
......
...@@ -41,7 +41,7 @@ bool memory_coloring_impl::allocate(interval_ptr interval) ...@@ -41,7 +41,7 @@ bool memory_coloring_impl::allocate(interval_ptr interval)
if(conflict_table.find(vn) != conflict_table.end()) if(conflict_table.find(vn) != conflict_table.end())
{ {
std::set<int>& vn_set = conflict_table[vn]; std::set<int>& vn_set = conflict_table[vn];
for(auto& iter : vn_set) for(const auto& iter : vn_set)
{ {
live_range* range = live_ranges[iter]; live_range* range = live_ranges[iter];
long long offset = range->offset; long long offset = range->offset;
...@@ -240,7 +240,7 @@ void memory_coloring_impl::verify() ...@@ -240,7 +240,7 @@ void memory_coloring_impl::verify()
if(conflict_table.find(vn) != conflict_table.end()) if(conflict_table.find(vn) != conflict_table.end())
{ {
std::set<int>& vn_set = conflict_table[vn]; std::set<int>& vn_set = conflict_table[vn];
for(auto& iter : vn_set) for(const auto& iter : vn_set)
{ {
live_range* range = live_ranges[iter]; live_range* range = live_ranges[iter];
if(range->offset == invalid_offset) if(range->offset == invalid_offset)
......
...@@ -81,9 +81,9 @@ struct memory_coloring_impl ...@@ -81,9 +81,9 @@ struct memory_coloring_impl
unify_literals = false; unify_literals = false;
} }
bool allocate(interval_ptr); bool allocate(interval_ptr);
void add_conflicts(std::set<int>& live_set, int val) void add_conflicts(const std::set<int>& live_set, int val)
{ {
for(auto& iter : live_set) for(const auto& iter : live_set)
{ {
conflict_table[iter].insert(val); conflict_table[iter].insert(val);
conflict_table[val].insert(iter); conflict_table[val].insert(iter);
...@@ -123,7 +123,7 @@ struct memory_coloring_impl ...@@ -123,7 +123,7 @@ struct memory_coloring_impl
#endif #endif
struct ordering struct ordering
{ {
bool operator()(const interval_ptr i1, const interval_ptr i2) const bool operator()(const interval_ptr& i1, const interval_ptr& i2) const
{ {
auto len1 = i1->get_end() - i1->get_begin(); auto len1 = i1->get_end() - i1->get_begin();
auto len2 = i2->get_end() - i2->get_begin(); auto len2 = i2->get_end() - i2->get_begin();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment