Skip to content

Commit

Permalink
src: common: make pd_impl_key rely on public value
Browse files Browse the repository at this point in the history
  • Loading branch information
dzarukin committed Aug 16, 2023
1 parent 4cc204f commit de0a50f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/common/c_types_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ const data_type_t s32 = dnnl_s32;
const data_type_t s8 = dnnl_s8;
const data_type_t u8 = dnnl_u8;
const data_type_t boolean = dnnl_boolean;
const data_type_t data_type_max = dnnl_data_type_max;

// Not exposed through API as all current uses are internal only
const data_type_t tf32 = static_cast<data_type_t>(1 << 8);
Expand Down
12 changes: 6 additions & 6 deletions src/common/impl_list_item.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2021-2022 Intel Corporation
* Copyright 2021-2023 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,12 +34,12 @@ struct pk_dt_impl_key_t {
}

private:
enum { MAX_DT_NUM = 10 };
size_t value() const {
return (((size_t)kind * MAX_DT_NUM + (size_t)src_dt) * MAX_DT_NUM
+ (size_t)wei_dt)
* MAX_DT_NUM
+ (size_t)dst_dt;
const size_t dtm = data_type::data_type_max;
const size_t m1 = static_cast<size_t>(kind) * dtm;
const size_t m2 = (m1 + static_cast<size_t>(src_dt)) * dtm;
const size_t m3 = (m2 + static_cast<size_t>(wei_dt)) * dtm;
return m3 + static_cast<size_t>(dst_dt);
}
};

Expand Down
7 changes: 4 additions & 3 deletions src/cpu/reorder/cpu_reorder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ struct reorder_impl_key_t {
}

private:
enum { MAX_DT_NUM = 10 };
size_t value() const {
return ((size_t)ndims * MAX_DT_NUM + (size_t)src_dt) * MAX_DT_NUM
+ (size_t)dst_dt;
const size_t dtm = data_type::data_type_max;
const size_t m1 = static_cast<size_t>(ndims) * dtm;
const size_t m2 = (m1 + static_cast<size_t>(src_dt)) * dtm;
return m2 + static_cast<size_t>(dst_dt);
}
};

Expand Down

0 comments on commit de0a50f

Please sign in to comment.