Skip to content

Commit 11e989c

Browse files
committed
[Comgr][v3.0] Remove deprecated set/get options APIs
- amd_comgr_action_info_set_options() - amd_comgr_action_info_get_options() This also removes the internal representation of a flat list Change-Id: Ia35d0f890099d116dd7b3389413eec88baba66f7
1 parent a84ffd6 commit 11e989c

File tree

8 files changed

+15
-438
lines changed

8 files changed

+15
-438
lines changed

amd/comgr/docs/ReleaseNotes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ Deprecated APIs
123123

124124
Removed APIs
125125
------------
126+
- amd\_comgr\_action\_info\_set\_options() (v3.0)
127+
- amd\_comgr\_action\_info\_get\_options() (v3.0)
128+
- Use amd\_comgr\_action\_info\_set\_option\_list(),
129+
amd\_comgr\_action\_info\_get\_option\_list\_count(), and
130+
amd\_comgr\_action\_info\_get\_option\_list\_item() instead
126131

127132
New Comgr Actions and Data Types
128133
--------------------------------

amd/comgr/include/amd_comgr.h.in

Lines changed: 2 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,92 +1233,11 @@ amd_comgr_action_info_get_language(
12331233
amd_comgr_action_info_t action_info,
12341234
amd_comgr_language_t *language) AMD_COMGR_VERSION_1_8;
12351235

1236-
/**
1237-
* @brief Set the options string of an action info object.
1238-
*
1239-
* When an action info object is created it has an empty options string.
1240-
*
1241-
* This overrides any option strings or arrays previously set by calls to this
1242-
* function or @p amd_comgr_action_info_set_option_list.
1243-
*
1244-
* An @p action_info object which had its options set with this function can
1245-
* only have its option inspected with @p amd_comgr_action_info_get_options.
1246-
*
1247-
* @param[in] action_info A handle to the action info object to be
1248-
* updated.
1249-
*
1250-
* @param[in] options A null terminated string that is the options. If
1251-
* NULL or the empty string then the options are cleared.
1252-
*
1253-
* @retval ::AMD_COMGR_STATUS_SUCCESS The function has
1254-
* been executed successfully.
1255-
*
1256-
* @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p
1257-
* action_info is an invalid action info object.
1258-
*
1259-
* @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES
1260-
* Unable to update action info object as out of resources.
1261-
*
1262-
* @deprecated since 1.3
1263-
* @see amd_comgr_action_info_set_option_list
1264-
*/
1265-
AMD_COMGR_DEPRECATED("Will be removed in Comgr v3.0 (Rocm v6.0). Use "
1266-
"amd_comgr_action_info_set_option_list() instead")
1267-
amd_comgr_status_t AMD_COMGR_API
1268-
amd_comgr_action_info_set_options(
1269-
amd_comgr_action_info_t action_info,
1270-
const char *options) AMD_COMGR_VERSION_1_8;
1271-
1272-
/**
1273-
* @brief Get the options string and/or options strings length of an action
1274-
* info object.
1275-
*
1276-
* The @p action_info object must have had its options set with @p
1277-
* amd_comgr_action_info_set_options.
1278-
*
1279-
* @param[in] action_info The action info object to query.
1280-
*
1281-
* @param[in, out] size On entry, the size of @p options. On return, if @p
1282-
* options is NULL, set to the size of the options including the terminating
1283-
* null character.
1284-
*
1285-
* @param[out] options If not NULL, then the first @p size characters of
1286-
* the options are copied. If the options are not set then an empty
1287-
* string is copied. If NULL, options is not copied, and only @p size
1288-
* is updated (useful inorder to find the size of buffer required to
1289-
* copy the options).
1290-
*
1291-
* @retval ::AMD_COMGR_STATUS_SUCCESS The function has
1292-
* been executed successfully.
1293-
*
1294-
* @retval ::AMD_COMGR_STATUS_ERROR The options of @p action_info were not set
1295-
* with @p amd_comgr_action_info_set_options.
1296-
*
1297-
* @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p
1298-
* action_info is an invalid action info object. @p size is NULL.
1299-
*
1300-
* @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES
1301-
* Unable to update the data object as out of resources.
1302-
*
1303-
* @deprecated since 1.3
1304-
* @see amd_comgr_action_info_get_option_list_count and
1305-
* amd_comgr_action_info_get_option_list_item
1306-
*/
1307-
AMD_COMGR_DEPRECATED("Will be removed in Comgr v3.0 (Rocm v6.0). Use "
1308-
"amd_comgr_action_info_get_option_list_count() "
1309-
"and amd_comgr_action_info_get_option_list_item() "
1310-
"instead")
1311-
amd_comgr_status_t AMD_COMGR_API
1312-
amd_comgr_action_info_get_options(
1313-
amd_comgr_action_info_t action_info,
1314-
size_t *size,
1315-
char *options) AMD_COMGR_VERSION_1_8;
1316-
13171236
/**
13181237
* @brief Set the options array of an action info object.
13191238
*
13201239
* This overrides any option strings or arrays previously set by calls to this
1321-
* function or @p amd_comgr_action_info_set_options.
1240+
* function.
13221241
*
13231242
* An @p action_info object which had its options set with this function can
13241243
* only have its option inspected with @p
@@ -1385,7 +1304,7 @@ amd_comgr_action_info_get_option_list_count(
13851304
*
13861305
* @param[in] index The index of the option to be returned. The first option
13871306
* index is 0. The order is the same as the options when they were added in @p
1388-
* amd_comgr_action_info_set_options.
1307+
* amd_comgr_action_info_set_option_list.
13891308
*
13901309
* @param[in, out] size On entry, the size of @p option. On return, if @option
13911310
* is NULL, set to the size of the Nth option string including the terminating

amd/comgr/src/amdcomgr.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ amd_comgr_action_info_set_isa_name
2424
amd_comgr_action_info_get_isa_name
2525
amd_comgr_action_info_set_language
2626
amd_comgr_action_info_get_language
27-
amd_comgr_action_info_set_options
28-
amd_comgr_action_info_get_options
2927
amd_comgr_action_info_set_option_list
3028
amd_comgr_action_info_get_option_list_count
3129
amd_comgr_action_info_get_option_list_item

amd/comgr/src/comgr-device-libs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ amd_comgr_status_t addDeviceLibraries(DataAction *ActionInfo,
131131
bool CorrectlyRoundedSqrt = false, DazOpt = false, FiniteOnly = false,
132132
UnsafeMath = false, Wavefrontsize64 = false;
133133
unsigned CodeObjectVersion = 0;
134-
for (auto &Option : ActionInfo->getOptions(true)) {
134+
for (auto &Option : ActionInfo->getOptions()) {
135135
// Parse code_object_v<N>
136136
if (StringRef CoV = Option; CoV.consume_front("code_object_v")) {
137137
// String is invalid if:

amd/comgr/src/comgr.cpp

Lines changed: 3 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ DataSet::~DataSet() {
452452

453453
DataAction::DataAction()
454454
: IsaName(nullptr), Path(nullptr), Language(AMD_COMGR_LANGUAGE_NONE),
455-
Logging(false), AreOptionsList(false) {}
455+
Logging(false) {}
456456

457457
DataAction::~DataAction() {
458458
free(IsaName);
@@ -467,22 +467,7 @@ amd_comgr_status_t DataAction::setActionPath(llvm::StringRef ActionPath) {
467467
return setCStr(this->Path, ActionPath);
468468
}
469469

470-
amd_comgr_status_t DataAction::setOptionsFlat(StringRef Options) {
471-
AreOptionsList = false;
472-
FlatOptions = Options.str();
473-
return AMD_COMGR_STATUS_SUCCESS;
474-
}
475-
476-
amd_comgr_status_t DataAction::getOptionsFlat(StringRef &Options) {
477-
if (AreOptionsList) {
478-
return AMD_COMGR_STATUS_ERROR;
479-
}
480-
Options = StringRef(FlatOptions.c_str(), FlatOptions.size() + 1);
481-
return AMD_COMGR_STATUS_SUCCESS;
482-
}
483-
484470
amd_comgr_status_t DataAction::setOptionList(ArrayRef<const char *> Options) {
485-
AreOptionsList = true;
486471
ListOptions.clear();
487472
for (auto &Option : Options) {
488473
ListOptions.push_back(Option);
@@ -491,18 +476,12 @@ amd_comgr_status_t DataAction::setOptionList(ArrayRef<const char *> Options) {
491476
}
492477

493478
amd_comgr_status_t DataAction::getOptionListCount(size_t &Size) {
494-
if (!AreOptionsList) {
495-
return AMD_COMGR_STATUS_ERROR;
496-
}
497479
Size = ListOptions.size();
498480
return AMD_COMGR_STATUS_SUCCESS;
499481
}
500482

501483
amd_comgr_status_t DataAction::getOptionListItem(size_t Index,
502484
StringRef &Option) {
503-
if (!AreOptionsList) {
504-
return AMD_COMGR_STATUS_ERROR;
505-
}
506485
if (Index >= ListOptions.size()) {
507486
return AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT;
508487
}
@@ -511,25 +490,7 @@ amd_comgr_status_t DataAction::getOptionListItem(size_t Index,
511490
return AMD_COMGR_STATUS_SUCCESS;
512491
}
513492

514-
ArrayRef<std::string> DataAction::getOptions(bool IsDeviceLibs) {
515-
// In the legacy path the ListOptions is used as a buffer to split the
516-
// options in. We have to do this lazily as the delimiter depends on
517-
// IsDeviceLibs. We could avoid re-splitting in the case where the same call
518-
// is repeated, but this path will be deprecated and removed anyway.
519-
if (!AreOptionsList) {
520-
ListOptions.clear();
521-
StringRef OptionsRef(FlatOptions);
522-
SmallVector<StringRef, 16> OptionRefs;
523-
if (IsDeviceLibs) {
524-
OptionsRef.split(OptionRefs, ',', -1, false);
525-
} else {
526-
OptionsRef.split(OptionRefs, ' ');
527-
}
528-
for (auto &Option : OptionRefs) {
529-
ListOptions.push_back(std::string(Option));
530-
}
531-
}
532-
493+
ArrayRef<std::string> DataAction::getOptions() {
533494
return ListOptions;
534495
}
535496

@@ -1117,45 +1078,6 @@ amd_comgr_status_t AMD_COMGR_API
11171078
return AMD_COMGR_STATUS_SUCCESS;
11181079
}
11191080

1120-
amd_comgr_status_t AMD_COMGR_API
1121-
// NOLINTNEXTLINE(readability-identifier-naming)
1122-
amd_comgr_action_info_set_options
1123-
//
1124-
(amd_comgr_action_info_t ActionInfo, const char *Options) {
1125-
DataAction *ActionP = DataAction::convert(ActionInfo);
1126-
1127-
if (!ActionP) {
1128-
return AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT;
1129-
}
1130-
1131-
return ActionP->setOptionsFlat(Options);
1132-
}
1133-
1134-
amd_comgr_status_t AMD_COMGR_API
1135-
// NOLINTNEXTLINE(readability-identifier-naming)
1136-
amd_comgr_action_info_get_options
1137-
//
1138-
(amd_comgr_action_info_t ActionInfo, size_t *Size, char *Options) {
1139-
DataAction *ActionP = DataAction::convert(ActionInfo);
1140-
1141-
if (!ActionP || !Size) {
1142-
return AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT;
1143-
}
1144-
1145-
StringRef ActionOptions;
1146-
if (auto Status = ActionP->getOptionsFlat(ActionOptions)) {
1147-
return Status;
1148-
}
1149-
1150-
if (Options) {
1151-
memcpy(Options, ActionOptions.data(), *Size);
1152-
} else {
1153-
*Size = ActionOptions.size();
1154-
}
1155-
1156-
return AMD_COMGR_STATUS_SUCCESS;
1157-
}
1158-
11591081
amd_comgr_status_t AMD_COMGR_API
11601082
// NOLINTNEXTLINE(readability-identifier-naming)
11611083
amd_comgr_action_info_set_option_list
@@ -1427,8 +1349,7 @@ amd_comgr_status_t AMD_COMGR_API
14271349
<< "\t ActionKind: " << getActionKindName(ActionKind) << '\n'
14281350
<< "\t IsaName: " << ActionInfoP->IsaName << '\n'
14291351
<< "\t Options:";
1430-
for (auto &Option : ActionInfoP->getOptions(
1431-
ActionKind == AMD_COMGR_ACTION_ADD_DEVICE_LIBRARIES)) {
1352+
for (auto &Option : ActionInfoP->getOptions()) {
14321353
*LogP << ' ';
14331354
printQuotedOption(*LogP, Option);
14341355
}

amd/comgr/src/comgr.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,6 @@ struct DataAction {
210210
amd_comgr_status_t setIsaName(llvm::StringRef IsaName);
211211
amd_comgr_status_t setActionPath(llvm::StringRef ActionPath);
212212

213-
// Set the options to be the legacy "flat" string.
214-
amd_comgr_status_t setOptionsFlat(llvm::StringRef Options);
215-
// If the options were set via setOptionsFlag, return a reference to the
216-
// string (including the null terminator).
217-
amd_comgr_status_t getOptionsFlat(llvm::StringRef &Options);
218-
219213
// Set the options to be the new list.
220214
amd_comgr_status_t setOptionList(llvm::ArrayRef<const char *> Options);
221215
// If the options were set via setOptionList, return the length of the list.
@@ -224,11 +218,9 @@ struct DataAction {
224218
// string at Index in the list (including the null terminator).
225219
amd_comgr_status_t getOptionListItem(size_t Index, llvm::StringRef &Option);
226220

227-
// Return a normalized array of options, possibly splitting a flat options
228-
// string. If splitting, ' ' is used as a delimiter if IsDeviceLibs is false,
229-
// otherwise ',' is used. The returned array reference is only valid as long
230-
// as no other option APIs are called.
231-
llvm::ArrayRef<std::string> getOptions(bool IsDeviceLibs = false);
221+
// Return an array of options. The returned array reference is only valid as
222+
// long as no other option APIs are called.
223+
llvm::ArrayRef<std::string> getOptions();
232224

233225
amd_comgr_status_t setBundleEntryIDs(llvm::ArrayRef<const char *> EntryIDs);
234226
llvm::ArrayRef<std::string> getBundleEntryIDs();
@@ -242,8 +234,6 @@ struct DataAction {
242234
std::vector<std::string> BundleEntryIDs;
243235

244236
private:
245-
bool AreOptionsList;
246-
std::string FlatOptions;
247237
std::vector<std::string> ListOptions;
248238
};
249239

amd/comgr/src/exportmap.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ global: amd_comgr_action_data_count;
55
amd_comgr_action_info_get_logging;
66
amd_comgr_action_info_get_option_list_count;
77
amd_comgr_action_info_get_option_list_item;
8-
amd_comgr_action_info_get_options;
98
amd_comgr_action_info_get_working_directory_path;
109
amd_comgr_action_info_set_language;
1110
amd_comgr_action_info_set_logging;
1211
amd_comgr_action_info_set_option_list;
13-
amd_comgr_action_info_set_options;
1412
amd_comgr_action_info_set_working_directory_path;
1513
amd_comgr_create_action_info;
1614
amd_comgr_create_data_set;

0 commit comments

Comments
 (0)