Skip to content

Update macro parameter names with parentheses #2913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 21, 2024
Merged

Update macro parameter names with parentheses #2913

merged 5 commits into from
Aug 21, 2024

Conversation

mikeessen
Copy link
Contributor

@mikeessen mikeessen commented Aug 20, 2024

Update code to add macro parameter names with parentheses to zDNNExtension and Stickify.

@mikeessen mikeessen marked this pull request as draft August 20, 2024 14:41
Signed-off-by: Mike Essenmacher <[email protected]>
@mikeessen mikeessen marked this pull request as ready for review August 20, 2024 17:37
Copy link
Collaborator

@AlexandreEichenberger AlexandreEichenberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grepping for #define *[\w_-]* *\( I find more patterns

e.g.

#define OM_TYPE_METADATA_DEF(ENUM_NAME, ENUM_VAL, DTYPE_SIZE, DTYPE_NAME)      \
  ENUM_NAME = ENUM_VAL,

or

#define INVOKE_ACCEL_INIT_FUNCTION(name, kinds)                                \
  if (!kinds.empty() &&                                                        \
      llvm::is_contained(kinds, accel::Accelerator::Kind::name))               \
    create##name()->setName(#name);
#define compareFunctionBody(typeName, direction, load, dataPtr, idx1p, idx2p)  \
  {                                                                            \
    uint64_t idx1 = *((uint64_t *)idx1p);                                      \
    uint64_t idx2 = *((uint64_t *)idx2p);                                      \
    typeName *data = (typeName *)dataPtr;                                      \
    load(typeName, v1, data[idx1]);                                            \
    load(typeName, v2, data[idx2]);                                            \
    return (direction(v1, v2) || (v1 == v2 && idx1 < idx2)) ? -1 : 1;          \
  }

and many more in that file

#define LOOP_1(INDEX, IV, UB)                                                  \
  fprintf(fout, "[");                                                          \
  for (int64_t IV = 0; IV < UB; ++IV) {                                        \
    if (IV)                                                                    \
      fprintf(fout, ", ");                                                     \
    indexes[INDEX] = IV;                                                       \
    int64_t elemOffset = computeElemOffset(tensor->_strides, indexes, rank);   \
    printElement(fout, dataPtr, elemOffset, dataType);                         \
  }                                                                            \
  fprintf(fout, "]");

and many more in that file

#define THREAD_LOCAL_INIT(key, func) pthread_once(key, func)
#define MIN(x, y) ((x) > (y) ? y : x)

and many more in that file

#define CHECK_CALL(type, var, call, success, ...)                              \
  type var = call;                                                             \
  do {                                                                         \
    if (!(success)) {                                                          \
      LOG_PRINTF(LOG_ERROR, __VA_ARGS__);                                      \
      return NULL;                                                             \
    }                                                                          \
  } while (0)

and many more in that file

#define BIT_CAST(TO_TYPE, TO, FROM)                                            \
  TO_TYPE TO;                                                                  \
  static_assert(sizeof(TO) == sizeof(FROM), "only bit cast same sizes");       \
  memcpy(&TO, &FROM, sizeof(FROM))

and more in that file

#define IGNORE_ARG(FLAG)                                                       \
  if (arg.find(FLAG) == 0) {                                                   \
    return false;                                                              \
  }

plus more in that file

Mike Essenmacher added 3 commits August 20, 2024 16:27
Signed-off-by: Mike Essenmacher <[email protected]>
Signed-off-by: Mike Essenmacher <[email protected]>
Signed-off-by: Mike Essenmacher <[email protected]>
@mikeessen
Copy link
Contributor Author

@AlexandreEichenberger Thanks for the comment! I added more updates.

Copy link
Collaborator

@AlexandreEichenberger AlexandreEichenberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for looking at all these other patterns

@mikeessen mikeessen merged commit 72d6c11 into onnx:main Aug 21, 2024
7 checks passed
@jenkins-droid
Copy link
Collaborator

Jenkins Linux s390x Build #15411 [push] Update macro parameter n... started at 07:15

@jenkins-droid
Copy link
Collaborator

Jenkins Linux ppc64le Build #14436 [push] Update macro parameter n... started at 07:24

@jenkins-droid
Copy link
Collaborator

Jenkins Linux amd64 Build #15406 [push] Update macro parameter n... started at 06:15

@jenkins-droid
Copy link
Collaborator

Jenkins Linux amd64 Build #15406 [push] Update macro parameter n... passed after 1 hr 7 min

@jenkins-droid
Copy link
Collaborator

Jenkins Linux s390x Build #15411 [push] Update macro parameter n... passed after 1 hr 31 min

@jenkins-droid
Copy link
Collaborator

Jenkins Linux ppc64le Build #14436 [push] Update macro parameter n... passed after 2 hr 8 min

@mikeessen mikeessen deleted the essen-updates branch September 5, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants