-
Notifications
You must be signed in to change notification settings - Fork 441
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
DPL Analysis: Table definition rewrite #13664
base: dev
Are you sure you want to change the base?
Conversation
REQUEST FOR PRODUCTION RELEASES:
This will add The following labels are available |
ceb880d
to
6701988
Compare
@@ -116,6 +116,7 @@ class ConstMCTruthContainer : public std::vector<char> | |||
#ifndef GPUCA_STANDALONE | |||
namespace o2::framework | |||
{ | |||
// FIXME: this is potentially dangerous |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be explained.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I will elaborate the comment.
@@ -55,7 +53,7 @@ auto createTableCursor(framework::ProcessingContext& pc) | |||
framework::Produces<T> c; | |||
c.resetCursor(pc.outputs() | |||
.make<framework::TableBuilder>(framework::OutputForTable<T>::ref())); | |||
c.setLabel(o2::aod::MetadataTrait<T>::metadata::tableLabel()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we rewrite aod::MetadataTrait<T>::metadata::tableLabel()
to simply return o2::aod::Hash<T::ref.label_hash>::str
? This way we would not need to change a few dozens of lines all at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately no, since the metadata trait is now defined only on the description/version hash and has no information about the label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand. T is the same class, no? Can't you simply have:
o2::aod::MetadataTrait<T>::metadata::tableLabel() {
return o2::aod::Hash<T::ref.label_hash>::str;
}
?
@@ -1348,7 +1348,7 @@ auto combinations(const BP& binningPolicy, int categoryNeighbours, const T1& out | |||
} | |||
} | |||
|
|||
template <typename... T2s> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This concept can probably be beneficial independently and it should be trivial to implement. This would allow us to remove a few lines from this diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand your point. You mean leaving a compatibility concept alias is_soa_filtered_v
and not adding the restrictions in the templates for now, so the file can be left unchanged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean the opposite. If we have a concept which makes sense already now, I would introduce it and use it, so that we get it out of the way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in #13679
|
||
#include <string> | ||
namespace o2::soa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given TableRef is a new class, we can simply add it and introduce these helpers, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is independent and can be added separately. Should I put it into a separate header then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you prefer. I think we can introduce any internal new classes / structs / concepts as long as we do not use them and there is no side effects or if they are merely a cleanup (e.g. soa::is_table
as you have elsewhere).
{ | ||
static_assert(sizeof...(PC) == sizeof...(T), "Argument number mismatch"); | ||
static_assert(sizeof...(Ts) == framework::pack_size(typename persistent_table_t::persistent_columns_t{}), "Argument number mismatch"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make this a require statement and drop the static_assert
return arg.globalIndex(); | ||
} else { | ||
static_assert(!framework::has_type<T>(framework::pack<PC...>{}), "Argument type mismatch"); | ||
static_assert(!framework::has_type<A>(typename persistent_table_t::persistent_columns_t{}), "Argument type mismatch"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use a requires arg.globalIndex()
and drop the static_assert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in #13679
|
||
template <template <o2::framework::OriginEnc, typename...> class T, o2::framework::OriginEnc ORIGIN, typename... C> | ||
struct Produces<T<ORIGIN, C...>> : WritingCursor<typename soa::PackToTable<ORIGIN, typename T<ORIGIN, C...>::table_t::persistent_columns_t>::table> { | ||
template <producable T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Producible
(with capital P), maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used std's approach to naming concepts, so is_producible
would be the better choice.
using expression_pack_t = typename aod::MetadataTrait<extension_t>::metadata::expression_pack_t; | ||
concept spawnable = soa::is_table<T> && soa::has_metadata<T>; | ||
|
||
template <spawnable T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capital s
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_spawnable
template <spawnable T> | ||
struct Spawns : TableTransform<typename aod::MetadataTrait<o2::aod::Hash<T::ref.desc_hash>>::metadata, T::ref> { | ||
using metadata = TableTransform<typename aod::MetadataTrait<o2::aod::Hash<T::ref.desc_hash>>::metadata, T::ref>::metadata; | ||
using extension_t = typename metadata::extension_table_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In retrospect these inline types are a bad idea, because the compiler is forced to instanciate them. Don't we have a better way of doing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed a common base class template for both Builds
and Spawns
. It is possible to define a function and put here a decltype of it, rather than the type name directly.
} | ||
|
||
template <typename C> | ||
struct ColumnTrait { | ||
static_assert(framework::is_base_of_template_v<o2::soa::Column, C>, "Not a column type!"); | ||
using column_t = C; | ||
|
||
static constexpr auto listSize() | ||
static consteval auto listSize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably consteval already now, no?
for (counter = 0; counter < tables[0]->num_rows(); ++counter) { | ||
auto idx = -1; | ||
if constexpr (std::is_same_v<T1, Key>) { | ||
for (int64_t counter = 0; counter < tables[0]->num_rows(); ++counter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does it work now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
counter
is uselessly defined few lines above, but is otherwise not used outside the loop.
} | ||
|
||
template <soa::is_table T> | ||
requires(!soa::is_filtered_table<T>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need the requires? It's simply the negation of the above, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_table
includes a is_filtered_table
and compiler considers the function call ambiguous without this. I have defined is_not_filtered_table
in #13679
@@ -417,47 +416,10 @@ struct OutputManager<Builds<T>> { | |||
} | |||
}; | |||
|
|||
template <typename T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can already go. No need to bind it to the table rewrite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in #13679
I have done a few comments. As discussed privately yesterday, we should try to minimise the differences and introduce "safe" / "unrelated" changes as soon as possible, to minimise the diff. In particular I think:
|
6701988
to
c19e9a7
Compare
c19e9a7
to
ddca440
Compare
Draft until AliceO2Group/O2Physics#8322 is merged.