Skip to content

Commit d049ed2

Browse files
malfetpytorchmergebot
authored andcommitted
[BE] Fix metal compilation warnings (pytorch#166315)
- Fixes `s/#pragma onces/#pragma once` typoe All methods in the headers must be inline, otherwise one gets barrage of following warnings ``` /Users/malfet/git/pytorch/pytorch/c10/metal/utils.h:337:7: warning: unused function 'conj<half __attribute__((ext_vector_type(2)))>' [-Wunused-function] half2 conj(half2 a) { ^ /Users/malfet/git/pytorch/pytorch/c10/metal/utils.h:342:8: warning: unused function 'conj<float __attribute__((ext_vector_type(2)))>' [-Wunused-function] float2 conj(float2 a) { ^ 2 warnings generated. ``` Pull Request resolved: pytorch#166315 Approved by: https://github.com/seemethere, https://github.com/atalman
1 parent 9901d44 commit d049ed2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

aten/src/ATen/native/mps/kernels/LinearAlgebra.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#pragma onces
1+
#pragma once
22
#include <c10/metal/common.h>
33

44
template <unsigned N = c10::metal::max_ndim>

c10/metal/utils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,17 +329,17 @@ struct pair {
329329
};
330330

331331
template <typename T>
332-
static T conj(T a) {
332+
inline T conj(T a) {
333333
return a;
334334
}
335335

336336
template <>
337-
half2 conj(half2 a) {
337+
inline half2 conj(half2 a) {
338338
return half2(a.x, -a.y);
339339
}
340340

341341
template <>
342-
float2 conj(float2 a) {
342+
inline float2 conj(float2 a) {
343343
return float2(a.x, -a.y);
344344
}
345345

0 commit comments

Comments
 (0)