Skip to content

topology2: Add build support#5153

Merged
lgirdwood merged 2 commits into
thesofproject:mainfrom
ranj063:fix/topology2_build
Jan 6, 2022
Merged

topology2: Add build support#5153
lgirdwood merged 2 commits into
thesofproject:mainfrom
ranj063:fix/topology2_build

Conversation

@ranj063
Copy link
Copy Markdown
Collaborator

@ranj063 ranj063 commented Jan 5, 2022

Move the cavs topologies to the cavs folder and build support for these
topologies.

Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com

Copy link
Copy Markdown
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

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

Maybe move the renames to a separate commit?

Comment thread scripts/build-tools.sh Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
export ALSA_CONFIG_DIR=${SOF_TOP}/tools/topology/topology2
export ALSA_CONFIG_DIR="${SOF_TOP}"/tools/topology/topology2

Use shellcheck. Shellcheck saves lives.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The last one does not belong to the foreach loop.

Comment thread tools/topology/topology2/CMakeLists.txt Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You don't need to omit the entire subdirectory, instead omit only the edge in the dependency graph and don't add this target to the default ALL target. In other words, only this line needs to be conditional:

add_dependencies(topologies2 topology2_cavs)

So everyone is aligned and runs the exact same CMake code at configuration time no matter what their ALSA version is. The difference comes later only at build time.

This is also more flexible for any adventurer who has multiple ALSA versions installed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

but as far as topology2 goes everything in the topology2 folder should be conditionally built based on version right? its not just topology2_cavs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes sorry, hasty review and copy/paste. The point is to use a scalpel to conditionally cut only the topology2 dependency in the graph, then all v2 dependency "leaves" will be configured and available but not built by default.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

so this look good?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No, instead of return() here use:

add_dependencies(ALL topologies2)

+ remove ALL above

Comment thread tools/topology/topology2/CMakeLists.txt Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should you make the MINOR optional?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

no, we want the 1.2.6 version which has the -I option added.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not supporting version 1.3 will be OK? Only allowed from 1.3.1 and above?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

i don;t understand. we check if version is less than 1.2.6, why will 1.3 be not supported?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

the string command doesnt check for version number. it only extracts it here

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe REGEX MATCH "[0-9].[0-9].[0-9] will fail to extract 1.3

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

you're right. fixed now

@ranj063 ranj063 force-pushed the fix/topology2_build branch from 0e63f95 to 4b743af Compare January 5, 2022 23:26
@ranj063
Copy link
Copy Markdown
Collaborator Author

ranj063 commented Jan 6, 2022

SOFCI TEST

@marc-hb
Copy link
Copy Markdown
Collaborator

marc-hb commented Jan 6, 2022

https://github.com/thesofproject/sof/runs/4721408331?check_suite_focus=true failed the testbench (that depends on test topologies) because of #5155 / #5156. Re-running it now (SOFCI TEST is only for sof-ci/jenkins)

EDIT: passed in https://github.com/thesofproject/sof/runs/4722009946?check_suite_focus=true

@marc-hb
Copy link
Copy Markdown
Collaborator

marc-hb commented Jan 6, 2022

The zephyr build failure in https://github.com/thesofproject/sof/runs/4721407875?check_suite_focus=true is not related to Zephyr and can be reproduced with commit 4b743af40cf4 like this:

./scripts/build-tools.sh -l
...
=> tries to build topology2 for some unknown reason.

Same for ./scripts/build-tools.sh -<ANYTHING SPECIFIC>

@marc-hb
Copy link
Copy Markdown
Collaborator

marc-hb commented Jan 6, 2022

=> tries to build topology2 for some unknown reason.

That was wrong, my bad. I got confused by the message Cannot build topology2. Minimum required version ..., I assumed it was printed at build time but it's printed at configure time.

@marc-hb
Copy link
Copy Markdown
Collaborator

marc-hb commented Jan 6, 2022

Found it! The zephyr image has no alsatplg.

Reproduction:

sudo mv /usr/bin/alsatplg /usr/bin/alsatplg.disabled

./scripts/build-tools.sh -l
-- The C compiler identification is GNU 9.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- No CMAKE_BUILD_TYPE, defaulting to Debug
CMake Error at topology/topology2/CMakeLists.txt:8 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.


CMake Error at topology/topology2/CMakeLists.txt:9 (if):
  if given arguments:

    "VERSION_LESS" "1.2.2"

  Unknown arguments specified


-- Configuring incomplete, errors occurred!

@ranj063 ranj063 force-pushed the fix/topology2_build branch 3 times, most recently from 557245e to f813869 Compare January 6, 2022 02:08
marc-hb
marc-hb previously requested changes Jan 6, 2022
Comment thread tools/topology/topology2/CMakeLists.txt Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
message(WARNING "Topology2 will be skipped. Minimum required version for alsatplg: 1.2.6")
message(WARNING "alsatplg error ${STATUS}, topology2 will be skipped")

Comment thread tools/topology/topology2/CMakeLists.txt Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
add_custom_target(topologies2 ALL)
add_custom_target(topologies2)

See below

Comment thread tools/topology/topology2/CMakeLists.txt Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No, instead of return() here use:

add_dependencies(ALL topologies2)

+ remove ALL above

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
add_custom_target(topology2_cavs ALL
add_custom_target(topology2_cavs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this the "silent" v1 -> v2 upgrade? If yes add a short comment.

Assuming there will be other subdirectories later besides cavs/, can this be done only once for all in the ../CMakeLists.txt?

Comment thread tools/topology/topology2/cavs/CMakeLists.txt Outdated
Comment thread tools/topology/topology2/cavs/CMakeLists.txt Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In general ${CMAKE_CURRENT_BINARY_DIR} is not required. You haven't used it below. Quick enough to try.

@ranj063 ranj063 force-pushed the fix/topology2_build branch from f813869 to fa307d8 Compare January 6, 2022 04:10
@ranj063 ranj063 requested a review from marc-hb January 6, 2022 04:11
@ranj063 ranj063 force-pushed the fix/topology2_build branch from fa307d8 to 41572eb Compare January 6, 2022 04:34
@marc-hb marc-hb dismissed their stale review January 6, 2022 04:50

Major comments addressed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would GREATER be more future-proof?

Suggested change
if (${last_index} EQUAL 2)
if (${length} GREATER 2)
math(EXPR last_index "${length}-1")

In any case I think testing ${length} would be slightly more readable.

Comment thread tools/topology/topology2/CMakeLists.txt Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this dependency real? Or is it just to make sure the v2 copy_directory "wins"? Either way a comment would probably not hurt.

Comment thread tools/topology/topology2/CMakeLists.txt Outdated
Copy link
Copy Markdown
Collaborator

@marc-hb marc-hb Jan 6, 2022

Choose a reason for hiding this comment

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

Why is topology2_cavs optional (should probably be called: topologiesV2_cavs) but topologies2 is not optional? In other words, shouldn't this test be located one level up in ../CMakeLists.txt?

@ranj063 ranj063 force-pushed the fix/topology2_build branch 2 times, most recently from 5f431cd to 81a9cee Compare January 6, 2022 05:52
@ranj063 ranj063 requested a review from marc-hb January 6, 2022 17:43
Copy link
Copy Markdown
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

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

Some nits left but good enough.

@ranj063
Copy link
Copy Markdown
Collaborator Author

ranj063 commented Jan 6, 2022

SOFCI TEST

Move all cavs tooplogies to the cavs folder.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Add build support for topology2. Topology2 will be built only if the
alsatplg version if 1.2.6 or greater.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@ranj063 ranj063 force-pushed the fix/topology2_build branch from 81a9cee to bd659e1 Compare January 6, 2022 18:05
@lgirdwood lgirdwood merged commit 308a24a into thesofproject:main Jan 6, 2022
marc-hb added a commit to marc-hb/sof that referenced this pull request Jan 6, 2022
All .tplg output files have been compared and are strictly identical
after the change.

The deprecation warnings were added more than one year ago in
https://github.com/alsa-project/alsa-lib/commits//706192341d1d0bbb906

Now that we just upgraded our Docker image to ALSA 1.2.6
(https://hub.docker.com/r/thesofproject/sof/tags) so thesofproject#5153 can enable
topology v2, the volume of warnings has became unbearable.  For instance
good luck trying to find the actual error messages for the build
failures of thesofproject#5155 - they're totally drowned in these deprecation
warnings.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
lgirdwood pushed a commit that referenced this pull request Jan 10, 2022
All .tplg output files have been compared and are strictly identical
after the change.

The deprecation warnings were added more than one year ago in
https://github.com/alsa-project/alsa-lib/commits//706192341d1d0bbb906

Now that we just upgraded our Docker image to ALSA 1.2.6
(https://hub.docker.com/r/thesofproject/sof/tags) so #5153 can enable
topology v2, the volume of warnings has became unbearable.  For instance
good luck trying to find the actual error messages for the build
failures of #5155 - they're totally drowned in these deprecation
warnings.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@aiChaoSONG
Copy link
Copy Markdown
Collaborator

If we add a new topology, which doesn't have any defines, that means the defines passed to -D option of alsatplg is empty. alsatplg takes next string as the optarg of -D, which coincidentally is -p. This is wrong, and we will have build failure. @ranj063 FYI

@marc-hb
Copy link
Copy Markdown
Collaborator

marc-hb commented Jan 21, 2022

Does alsatplg -D "" -p ... work? The -D argument is a list, so an empty list should work too. If it does not then alsatplg should be fixed.

In the mean time how about the -D ignored-=placeholder workaround?

@marc-hb
Copy link
Copy Markdown
Collaborator

marc-hb commented Jan 24, 2022

Fix in #5249

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.

4 participants