From 2bd45ef127df5ad27ace4099086c4a6e814e52f0 Mon Sep 17 00:00:00 2001 From: Bolin Sun Date: Sat, 23 Mar 2024 16:52:41 -0400 Subject: [PATCH 1/5] rename op --- python/hidet/graph/ops/__init__.py | 2 +- python/hidet/graph/ops/matmul/__init__.py | 2 +- python/hidet/graph/ops/matmul/matmul_f32_x86.py | 2 +- tests/operators/test_matmul.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/hidet/graph/ops/__init__.py b/python/hidet/graph/ops/__init__.py index 52a710a53..b5f8f6bb9 100644 --- a/python/hidet/graph/ops/__init__.py +++ b/python/hidet/graph/ops/__init__.py @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # pylint: disable=redefined-builtin -from .matmul import batch_matmul, matmul, matmul_x86, matmul_cublas +from .matmul import batch_matmul, matmul, batch_matmul_x86, matmul_cublas from .conv1d import conv1d, conv1d_gemm from .conv1d_transpose import conv1d_transpose from .conv2d import conv2d, conv2d_channel_last, conv2d_winograd, conv2d_gemm, conv2d_gemm_fp16 diff --git a/python/hidet/graph/ops/matmul/__init__.py b/python/hidet/graph/ops/matmul/__init__.py index ae3f4c217..d5ea6210b 100644 --- a/python/hidet/graph/ops/matmul/__init__.py +++ b/python/hidet/graph/ops/matmul/__init__.py @@ -16,4 +16,4 @@ from .matmul_f32_x86 import Matmulx86Op, MatmulF32Taskx86 -from .matmul_f32_x86 import matmul_x86 +from .matmul_f32_x86 import batch_matmul_x86 diff --git a/python/hidet/graph/ops/matmul/matmul_f32_x86.py b/python/hidet/graph/ops/matmul/matmul_f32_x86.py index eeb467b30..eac114ee9 100644 --- a/python/hidet/graph/ops/matmul/matmul_f32_x86.py +++ b/python/hidet/graph/ops/matmul/matmul_f32_x86.py @@ -858,5 +858,5 @@ def __init__(self, a: Tensor, b: Tensor): super().__init__(inputs=[a, b], attributes={}, task=task) -def matmul_x86(a: Tensor, b: Tensor) -> Tensor: +def batch_matmul_x86(a: Tensor, b: Tensor) -> Tensor: return Matmulx86Op(a, b).outputs[0] diff --git a/tests/operators/test_matmul.py b/tests/operators/test_matmul.py index c5c67aa50..00b09de72 100644 --- a/tests/operators/test_matmul.py +++ b/tests/operators/test_matmul.py @@ -26,7 +26,7 @@ def test_matmul_x86(a_shape, b_shape): a_shape, b_shape, lambda x, y: np.matmul(x, y), - lambda x, y: ops.matmul_x86(x, y) - ops.matmul_x86(x, y) + ops.matmul_x86(x, y), + lambda x, y: ops.batch_matmul_x86(x, y) - ops.batch_matmul_x86(x, y) + ops.batch_matmul_x86(x, y), dtype="float32", atol=1e-4, rtol=1e-4, From e5f9b0fbc77568595e0442bfd535823617e1fbc0 Mon Sep 17 00:00:00 2001 From: Bolin Sun Date: Sat, 23 Mar 2024 20:51:16 -0400 Subject: [PATCH 2/5] ... --- python/hidet/graph/ops/matmul/matmul_f32_x86.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/hidet/graph/ops/matmul/matmul_f32_x86.py b/python/hidet/graph/ops/matmul/matmul_f32_x86.py index eac114ee9..8d3e23074 100644 --- a/python/hidet/graph/ops/matmul/matmul_f32_x86.py +++ b/python/hidet/graph/ops/matmul/matmul_f32_x86.py @@ -859,4 +859,4 @@ def __init__(self, a: Tensor, b: Tensor): def batch_matmul_x86(a: Tensor, b: Tensor) -> Tensor: - return Matmulx86Op(a, b).outputs[0] + return Matmulx86Op(a, b).outputs[0] \ No newline at end of file From 65fc51bd708109b3f1d90f1280c584868bca6068 Mon Sep 17 00:00:00 2001 From: Bolin Sun Date: Wed, 27 Mar 2024 21:09:36 -0400 Subject: [PATCH 3/5] change to single thread to compare and debug --- python/hidet/graph/ops/matmul/matmul_f32_x86.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/hidet/graph/ops/matmul/matmul_f32_x86.py b/python/hidet/graph/ops/matmul/matmul_f32_x86.py index 8d3e23074..03bae6273 100644 --- a/python/hidet/graph/ops/matmul/matmul_f32_x86.py +++ b/python/hidet/graph/ops/matmul/matmul_f32_x86.py @@ -82,7 +82,7 @@ def implement_cpu(self, working_dir: str) -> Union[IRModule, List[IRModule]]: return tune.extract_ir_modules(self.schedule_matmulf32_x86) @tune.space(1, MC=[2016], NC=[256, 384, 512], KC=[384, 512, 560], ways=[(1, 4, 2, 1)]) - def schedule_matmulf32_x86(self, MC=2016, NC=384, KC=560, ways=(1, 4, 2, 1)) -> IRModule: + def schedule_matmulf32_x86(self, MC=2016, NC=384, KC=560, ways=(1, 1, 1, 1)) -> IRModule: import hidet from hidet.ir.type import tensor_type from hidet.lang import tensor, grid, as_tensor_pointer From 36580830d4403c1b152e88a9e470237c56eef5b7 Mon Sep 17 00:00:00 2001 From: Bolin Sun Date: Fri, 5 Apr 2024 20:54:13 -0400 Subject: [PATCH 4/5] adding header guards --- include/hidet/runtime/callbacks.h | 2 ++ include/hidet/runtime/cpu/bfloat16.h | 2 +- include/hidet/runtime/cpu/complex.h | 2 ++ include/hidet/runtime/cpu/float16.h | 2 ++ include/hidet/runtime/cpu/float32.h | 3 +++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/hidet/runtime/callbacks.h b/include/hidet/runtime/callbacks.h index 3a104ac66..84fe7064c 100644 --- a/include/hidet/runtime/callbacks.h +++ b/include/hidet/runtime/callbacks.h @@ -9,6 +9,8 @@ // 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. +#pragma once + #include #include diff --git a/include/hidet/runtime/cpu/bfloat16.h b/include/hidet/runtime/cpu/bfloat16.h index 864f41100..44dc93f55 100644 --- a/include/hidet/runtime/cpu/bfloat16.h +++ b/include/hidet/runtime/cpu/bfloat16.h @@ -88,7 +88,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +#pragma once #include #include #include diff --git a/include/hidet/runtime/cpu/complex.h b/include/hidet/runtime/cpu/complex.h index d1f3bd57e..9e7cad01a 100644 --- a/include/hidet/runtime/cpu/complex.h +++ b/include/hidet/runtime/cpu/complex.h @@ -9,6 +9,8 @@ // 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. +#pragma once + #include typedef std::complex complex64_t; diff --git a/include/hidet/runtime/cpu/float16.h b/include/hidet/runtime/cpu/float16.h index 42bea52f8..011380edb 100644 --- a/include/hidet/runtime/cpu/float16.h +++ b/include/hidet/runtime/cpu/float16.h @@ -89,6 +89,8 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#pragma once + #include #include #include diff --git a/include/hidet/runtime/cpu/float32.h b/include/hidet/runtime/cpu/float32.h index 762336418..a2de27e72 100644 --- a/include/hidet/runtime/cpu/float32.h +++ b/include/hidet/runtime/cpu/float32.h @@ -9,6 +9,9 @@ // 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. + +#pragma once + #include static inline float rsqrtf(float x) From 675aa869753babd3519e6bee89f7b25b2a8a6fdc Mon Sep 17 00:00:00 2001 From: Bolin Sun Date: Fri, 5 Apr 2024 20:55:34 -0400 Subject: [PATCH 5/5] reformat --- python/hidet/graph/ops/matmul/matmul_f32_x86.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/hidet/graph/ops/matmul/matmul_f32_x86.py b/python/hidet/graph/ops/matmul/matmul_f32_x86.py index 03bae6273..7126fd210 100644 --- a/python/hidet/graph/ops/matmul/matmul_f32_x86.py +++ b/python/hidet/graph/ops/matmul/matmul_f32_x86.py @@ -859,4 +859,4 @@ def __init__(self, a: Tensor, b: Tensor): def batch_matmul_x86(a: Tensor, b: Tensor) -> Tensor: - return Matmulx86Op(a, b).outputs[0] \ No newline at end of file + return Matmulx86Op(a, b).outputs[0]