okay, dang. seems cmake isn't making the compiler use the c++11 standard. I believe it should be with the settings I gave but I'm no CMake pro.
I wonder what happens if you run: CXX=clang++ make
Either way, we should be able to get it to use c++11.
I'll be on IRC [#dataflow] as "xnor" tomorrow between around 10am and around 5pm Pacific Standard Time [west coast USA] tomorrow, on an osx machine.
Hit me up if you're around.

-Alex


On Sun, Mar 18, 2018 at 4:52 PM, Marco Matteo Markidis <mm.markidis@gmail.com> wrote:
(probably) last mail of the night :)
I update the llvm to 5.0 and add the cxx flags for include flex header and m_pd.h. Anyway, something goes wrong...

MMMarkidis:jit_expr dis$ make

[  7%] Building CXX object src/parse/CMakeFiles/parse.dir/scanner.cc.o

In file included from scan.ll:4:

In file included from parse.yy:12:

In file included from /Users/dis/Documents/Pd/externals/jit_expr/src/parse/driver.hh:9:

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:26:18: error: no type

      named 'shared_ptr' in namespace 'std'

    typedef std::shared_ptr<Node> NodePtr;

            ~~~~~^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:26:28: error: 

      expected unqualified-id

    typedef std::shared_ptr<Node> NodePtr;

                           ^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:27:18: error: no type

      named 'shared_ptr' in namespace 'std'

    typedef std::shared_ptr<Variable> VariablePtr;

            ~~~~~^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:27:28: error: 

      expected unqualified-id

    typedef std::shared_ptr<Variable> VariablePtr;

                           ^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:28:18: error: no type

      named 'shared_ptr' in namespace 'std'

    typedef std::shared_ptr<SampleAccess> SampleAccessPtr;

            ~~~~~^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:28:28: error: 

      expected unqualified-id

    typedef std::shared_ptr<SampleAccess> SampleAccessPtr;

                           ^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:29:18: error: no type

      named 'shared_ptr' in namespace 'std'

    typedef std::shared_ptr<ArrayAccess> ArrayAccessPtr;

            ~~~~~^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:29:28: error: 

      expected unqualified-id

    typedef std::shared_ptr<ArrayAccess> ArrayAccessPtr;

                           ^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:30:18: error: no type

      named 'shared_ptr' in namespace 'std'

    typedef std::shared_ptr<Deref> DerefPtr;

            ~~~~~^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:30:28: error: 

      expected unqualified-id

    typedef std::shared_ptr<Deref> DerefPtr;

                           ^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:31:18: error: no type

      named 'function' in namespace 'std'

    typedef std::function<void(std::string v, unsigned int depth)> PrintFunc;

            ~~~~~^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:31:26: error: 

      expected unqualified-id

    typedef std::function<void(std::string v, unsigned int depth)> PrintFunc;

                         ^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:33:36: error: no

      member named 'VariablePtr' in namespace 'xnor::ast'

    typedef std::vector<xnor::ast::VariablePtr> VariableVector;

                        ~~~~~~~~~~~^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:112:16: error: 

      unknown type name 'VariablePtr'; did you mean 'Variable'?

        Quoted(VariablePtr var);

               ^~~~~~~~~~~

               Variable

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:75:11: note: 

      'Variable' declared here

    class Variable : public VNode<Variable> {

          ^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:116:9: error: 

      unknown type name 'VariablePtr'; did you mean 'Variable'?

        VariablePtr variable() const { return mQuotedVar; }

        ^~~~~~~~~~~

        Variable

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:75:11: note: 

      'Variable' declared here

    class Variable : public VNode<Variable> {

          ^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:119:9: error: 

      unknown type name 'VariablePtr'; did you mean 'Variable'?

        VariablePtr mQuotedVar = nullptr;

        ^~~~~~~~~~~

        Variable

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:75:11: note: 

      'Variable' declared here

    class Variable : public VNode<Variable> {

          ^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:119:34: error: no

      viable conversion from 'nullptr_t' to 'xnor::ast::Variable'

        VariablePtr mQuotedVar = nullptr;

                                 ^~~~~~~

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:75:11: note: 

      candidate constructor (the implicit copy constructor) not viable: no known

      conversion from 'nullptr_t' to 'const xnor::ast::Variable &' for 1st

      argument

    class Variable : public VNode<Variable> {

          ^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:85:9: note: 

      candidate constructor not viable: no known conversion from 'nullptr_t' to

      'const std::string &' (aka 'const basic_string<char> &') for 1st argument

        Variable(const std::string& n);

        ^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:129:24: error: 

      unknown type name 'NodePtr'

        UnaryOp(Op op, NodePtr node);

                       ^

/Users/dis/Documents/Pd/externals/jit_expr/src/parse/ast.h:132:9: error: 

      unknown type name 'NodePtr'

        NodePtr node() const { return mNode; }

        ^

fatal error: too many errors emitted, stopping now [-ferror-limit=]

20 errors generated.

make[3]: *** [src/parse/CMakeFiles/parse.dir/scanner.cc.o] Error 1

make[2]: *** [src/parse/CMakeFiles/parse.dir/all] Error 2

make[1]: *** [all] Error 2

make: *** [pd] Error 2



2018-03-18 23:38 GMT+01:00 Marco Matteo Markidis <mm.markidis@gmail.com>:
I managed to add llvm but compilation fails.

MMMarkidis:jit_expr dis$ make

[  7%] [FLEX][Scanner] Building scanner with flex 2.6.4

[ 15%] [BISON][Parser] Building parser with bison 3.0.4

Scanning dependencies of target parse

[ 23%] Building CXX object src/parse/CMakeFiles/parse.dir/scanner.cc.o

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:772:8: error: 

      member reference type 'std::istream *' (aka 'basic_istream<char> *') is a

      pointer; maybe you meant to use '->'?

                        yyin.rdbuf(std::cin.rdbuf());

                        ~~~~^

                            ->

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:779:9: error: 

      member reference type 'std::ostream *' (aka 'basic_ostream<char> *') is a

      pointer; maybe you meant to use '->'?

                        yyout.rdbuf(std::cout.rdbuf());

                        ~~~~~^

                             ->

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1112:50: error: 

      member reference type 'std::istream *' (aka 'basic_istream<char> *') is a

      pointer; maybe you meant to use '->'?

                        YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin.rdbuf();

                                                                  ~~~~^

                                                                      ->

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1232:2: error: 

      cannot initialize a member subobject of type 'std::istream *' (aka

      'basic_istream<char> *') with an rvalue of type

      'basic_streambuf<char_type, traits_type> *'

        yyin(arg_yyin ? arg_yyin->rdbuf() : std::cin.rdbuf()),

        ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1233:2: error: 

      cannot initialize a member subobject of type 'std::ostream *' (aka

      'basic_ostream<char> *') with an rvalue of type

      'basic_streambuf<char_type, traits_type> *'

        yyout(arg_yyout ? arg_yyout->rdbuf() : std::cout.rdbuf())

        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1235:2: error: 

      use of undeclared identifier 'ctor_common'

        ctor_common();

        ^

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1240:14: error: 

      out-of-line definition of 'parseFlexLexer' does not match any declaration

      in 'parseFlexLexer'

yyFlexLexer::yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout ):

             ^~~~~~~~~~~

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:30:25: note: 

      expanded from macro 'yyFlexLexer'

    #define yyFlexLexer parseFlexLexer

                        ^~~~~~~~~~~~~~

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1231:27: note: 

      type of 1st parameter of member declaration does not match definition

      ('std::istream *' (aka 'basic_istream<char> *') vs 'std::istream &' (aka

      'basic_istream<char> &'))

yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout ):

                          ^

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1241:2: error: 

      cannot initialize a member subobject of type 'std::istream *' (aka

      'basic_istream<char> *') with an rvalue of type

      'basic_streambuf<char_type, traits_type> *'

        yyin(arg_yyin.rdbuf()),

        ^    ~~~~~~~~~~~~~~~~

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1242:2: error: 

      cannot initialize a member subobject of type 'std::ostream *' (aka

      'basic_ostream<char> *') with an rvalue of type

      'basic_streambuf<char_type, traits_type> *'

        yyout(arg_yyout.rdbuf())

        ^     ~~~~~~~~~~~~~~~~~

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1244:2: error: 

      use of undeclared identifier 'ctor_common'

        ctor_common();

        ^

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1249:19: error: 

      out-of-line definition of 'ctor_common' does not match any declaration in

      'parseFlexLexer'

void yyFlexLexer::ctor_common()

                  ^~~~~~~~~~~

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1287:19: error: 

      out-of-line definition of 'switch_streams' does not match any declaration

      in 'parseFlexLexer'

void yyFlexLexer::switch_streams( std::istream& new_in, std::ostream& new_out )

                  ^~~~~~~~~~~~~~

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/FlexLexer.h:129:31: note: 

      type of 1st parameter of member declaration does not match definition

      ('std::istream *' (aka 'basic_istream<char> *') vs 'std::istream &' (aka

      'basic_istream<char> &'))

        virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ...

                                     ^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/FlexLexer.h:53:22: note: 

      expanded from macro 'FLEX_STD'

#    define FLEX_STD std::

                     ^

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1291:41: error: 

      no viable conversion from 'std::istream' (aka 'basic_istream<char>') to

      'std::istream *' (aka 'basic_istream<char> *')

        yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  ) );

                                               ^~~~~~

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/FlexLexer.h:121:62: note: 

      passing argument to parameter 's' here

        struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size );

                                                                    ^

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1294:7: error: 

      member reference type 'std::ostream *' (aka 'basic_ostream<char> *') is a

      pointer; maybe you meant to use '->'?

        yyout.rdbuf(new_out.rdbuf());

        ~~~~~^

             ->

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1302:10: error: 

      assigning to 'std::istream *' (aka 'basic_istream<char> *') from

      incompatible type 'std::istream **' (aka 'basic_istream<char> **'); remove

      &

                new_in = &yyin;

                       ^ ~~~~~

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1306:11: error: 

      assigning to 'std::ostream *' (aka 'basic_ostream<char> *') from

      incompatible type 'std::ostream **' (aka 'basic_ostream<char> **'); remove

      &

                new_out = &yyout;

                        ^ ~~~~~~

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1315:18: error: 

      out-of-line definition of 'LexerInput' does not match any declaration in

      'parseFlexLexer'

int yyFlexLexer::LexerInput( char* buf, int max_size )

                 ^~~~~~~~~~

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1318:11: error: 

      member reference type 'std::istream *' (aka 'basic_istream<char> *') is a

      pointer; maybe you meant to use '->'?

        if ( yyin.eof() || yyin.fail() )

             ~~~~^

                 ->

/Users/dis/Documents/Pd/externals/jit_expr/build/src/parse/scanner.cc:1318:25: error: 

      member reference type 'std::istream *' (aka 'basic_istream<char> *') is a

      pointer; maybe you meant to use '->'?

        if ( yyin.eof() || yyin.fail() )

                           ~~~~^

                               ->

fatal error: too many errors emitted, stopping now [-ferror-limit=]

20 errors generated.

make[3]: *** [src/parse/CMakeFiles/parse.dir/scanner.cc.o] Error 1

make[2]: *** [src/parse/CMakeFiles/parse.dir/all] Error 2

make[1]: *** [all] Error 2

make: *** [pd] Error 2


2018-03-18 22:49 GMT+01:00 Marco Matteo Markidis <mm.markidis@gmail.com>:
Hi Alex,

jit_expr.pd_darwin is in the same folder of help file. Usually it works...
On my machine, Deken puts the externals in Pd/externals and in my path I have Pd/externals.

Anyway, putting all stuff in verbose I get in console:

/Users/dis/Documents/Pd/externals/jit_expr/jit_expr.pd_darwin: dlopen(/Users/dis/Documents/Pd/externals/jit_expr/jit_expr.pd_darwin, 10): Symbol not found: _futimens
  Referenced from: /Users/dis/Documents/Pd/externals/jit_expr/jit_expr.pd_darwin (which was built for Mac OS X 10.13)
  Expected in: /usr/lib/libSystem.B.dylib
 in /Users/dis/Documents/Pd/externals/jit_expr/jit_expr.pd_darwin

So there is futimens function that is not found; indeed looking at symbols present in my /usr/lib/libSystem.B.dylib futimens is not present. So I suspect that passing from OSX 10.10.5 (my os) to OSX 10.13 (the one you use to compile) something changes.

Finally, I tried to compile jit_expr. However Cmake 3.10.2 does not find LLVMConfig.cmake or llvm-config.cmake. I have several llvm installed on my machine with macports, but even using find command I do not find manually any of these two files. 

Best,
Marco

Ps. I found a LLVM-Config.cmake but I don't know how to add this path or set a LLVM_DIR. 

2018-03-18 19:22 GMT+01:00 Alex <x37v.alex@gmail.com>:
Hi Marco,

HMM, where did you install jit_expr.pd_darwin ? Deken initially sets up a directory for you if you tell it to, I believe. I think on mac this is in ~/Documents/Pd/extra ?
Can you tell me what is in your "path" settings, on mac the "file" menu item might be just called "Pd"? I'm not sure [I'm on a linux machine right now]
File -> preferences -> path

-Alex


On Sun, Mar 18, 2018 at 10:10 AM, Marco Matteo Markidis <mm.markidis@gmail.com> wrote:
Sorry, 
I forgot to let you know all the important informations.

Pd vanilla 48.1 64 bit, OSX, downloaded from deken binaries and sources. help file doesn't work opening from pd browser and directly double-clicking.

I tried even copy pd.lib in the same folder of help & pd.darwin, but without success.

2018-03-18 18:04 GMT+01:00 Alex <x37v.alex@gmail.com>:
Hi Marco,

Which version of PD are you running? Which OS? I expect you downloaded jit_expr from deken?
Does the jit_expr help file work if you open it in the pd browser? help -> browse -> jit_expr -> double click on the jit_expr-help.pd file?

-Alex
 

On Sun, Mar 18, 2018 at 9:49 AM, Marco Matteo Markidis <mm.markidis@gmail.com> wrote:
Dear Alex,

very happy about this new feature... and incredibly very happy about hearing just-in-time compiling dsp graph!
Anyway, I get only various jit/expr, jit/expr~, jit/fexpr~ couldn't create...
I tried to change the [declare -lib] in [declare -path], jit_expr in jit/expr in declare, looking to have the right 64 bit pd but nothing...

Best,
Marco

2018-03-18 17:34 GMT+01:00 Alex <x37v.alex@gmail.com>:
Alexandre,

I don't think it has had enough usage to be called "stable" yet, but I could see that happening down the line. In fact, I could see eventually JIT compiling the entire DSP graph.. but of course that would be significant work. At this point I just need more people to try it out and make sure it would be up to it.

-Alex


On Sun, Mar 18, 2018 at 9:23 AM, Alexandre Torres Porres <porres@gmail.com> wrote:
if this is stable, wouldn't it be a nice idea to propose it as an update to the expr~ family of objects? since it is basically an optimized clone?

cheers

2018-03-18 13:08 GMT-03:00 Alex <x37v.alex@gmail.com>:
jit_expr is a clone of the pure data expr/expr~/fexpr~ objects. It just-in-time compiles its expressions so they should be much more optimized than the original. If all works as designed, they should use less CPU than the equivalent vanilla, non-expr, patching and have a significant CPU advantage over the original expr objects.

I've put the external, compiled for 64-bit Mac-OS and 64-bit Linux, up on deken: in pd, go to help menu, find externals, search for "jit_expr".

After installing the external you should be able to change any of your expr family of objects to just in time compile by loading the library, [declare -lib jit_expr], and then prefixing the object name with "jit/", for example [jit/fexpr~ $x1[0] + $y1[-1]].

I believe they are feature complete with the originals but I'd love to know if there is anything that I'm missing or any bugs that you discover.
I'm not exactly sure how to profile pure data patches. If anyone has a good approach or original expr~/fexpr~ patches that use a lot of CPU you can share, let me know.

Compiling in the object takes a little bit of time, so the initial instantiation of the object/expression will be a bit slower than the original, FYI.

Please report any issues here:
https://github.com/x37v/jit-expr/issues


BTW, if you're curious to see the llvm assembly produced by your expression, send the |print( message into the left most inlet of your object then check out the pd console.


I would love help building Windows and 32-bit Linux versions of the externals. I'm guessing we could also do raspi/arm builds but we'd need some changes to the source code as it uses llvm and explicitly generates code for x86 right now.

The source code can be found in the git repo:

-Alex Norman

_______________________________________________
Pd-announce mailing list
Pd-announce@lists.iem.at
https://lists.puredata.info/listinfo/pd-announce

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list



_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list



_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list




--
Ho cambiato l'indirizzo email in mm.markidis@autistici.org . Se non è un problema, scrivimi a questo nuovo indirizzo email.

I changed my email address in mm.markidis@autistici.org . If it is ok for you, please write me to this new email address.

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list





--
Ho cambiato l'indirizzo email in mm.markidis@autistici.org . Se non è un problema, scrivimi a questo nuovo indirizzo email.

I changed my email address in mm.markidis@autistici.org . If it is ok for you, please write me to this new email address.

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list





--
Ho cambiato l'indirizzo email in mm.markidis@autistici.org . Se non è un problema, scrivimi a questo nuovo indirizzo email.

I changed my email address in mm.markidis@autistici.org . If it is ok for you, please write me to this new email address.



--
Ho cambiato l'indirizzo email in mm.markidis@autistici.org . Se non è un problema, scrivimi a questo nuovo indirizzo email.

I changed my email address in mm.markidis@autistici.org . If it is ok for you, please write me to this new email address.



--
Ho cambiato l'indirizzo email in mm.markidis@autistici.org . Se non è un problema, scrivimi a questo nuovo indirizzo email.

I changed my email address in mm.markidis@autistici.org . If it is ok for you, please write me to this new email address.

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list