Shop OBEX P1 Docs P2 Docs Learn Events
Hub Execution Makes Things Too Open-Ended — Parallax Forums

Hub Execution Makes Things Too Open-Ended

cgraceycgracey Posts: 14,134
edited 2014-03-26 11:47 in Propeller 2
It's been creeping up on me that perhaps hub exec makes things so open-ended, that it actually is slowing people's engagement down, because they are not dealing with a limited space, anymore, and anything is possible. Would you all concur?

When something is finite, it's fun to attack, since it poses a finite challenge and you are anxious to master it. When something becomes somewhat infinite, the drive to engage can become more diffuse, because of an awareness that anything is probably possible, but..... so what, then? Tight spaces invite challenges, while big spaces just languish like a floaty question mark.
«1

Comments

  • David BetzDavid Betz Posts: 14,516
    edited 2014-03-25 17:48
    cgracey wrote: »
    It's been creeping up on me that perhaps hub exec makes things so open-ended, that it actually is slowing people's engagement down, because they are not dealing with a limited space, anymore, and anything is possible. Would you all concur?

    When something is finite, it's easy to attack, since you are anxious to master it. When something becomes somewhat infinite, the effort can become more diffuse, because of an awareness that anything is probably possible, but..... so what!
    Well, it's not completely open ended. You are still limited to 256K of hub memory! :-)
  • Bill HenningBill Henning Posts: 6,445
    edited 2014-03-25 17:50
    Personally, I find the cog size limits being gone exhilirating.

    I know I will be able to do a lot more - and a lot more interesting things - because of hubexec.

    LMM was great on the P1, it allowed porting C ... but it also had a huge performance hit. That performance hit is basically history.

    Now we will need great docs, but frankly, it will be a lot easier to explain hubexec to people, than the limitations of having to fit into a cog.

    No need to answer the "HUH? You have 256KB of ram, but you can only write <2KB programs????"

    cgracey wrote: »
    It's been creeping up on me that perhaps hub exec makes things so open-ended, that it actually is slowing people's engagement down, because they are not dealing with a limited space, anymore, and anything is possible. Would you all concur?

    When something is finite, it's easy to attack, since you are anxious to master it. When something becomes somewhat infinite, the effort can become more diffuse, because of an awareness that anything is probably possible, but..... so what!
  • SapiehaSapieha Posts: 2,964
    edited 2014-03-25 17:54
    Hi Chip.

    NOT so open-ended as You think.

    It is why I made my question in other thread about LOCBASE.

    AS I write COG based code --- BUT will address some pointers that exist in HUB --->
    BUT that pointers will be filled by COG code in runtime


    cgracey wrote: »
    It's been creeping up on me that perhaps hub exec makes things so open-ended, that it actually is slowing people's engagement down, because they are not dealing with a limited space, anymore, and anything is possible. Would you all concur?

    When something is finite, it's fun to attack, since you are anxious to master it. When something becomes somewhat infinite, the effort can become more diffuse, because of an awareness that anything is probably possible, but..... so what! Tight spaces invite challenges, while big spaces just languish like a floaty question mark.
  • ozpropdevozpropdev Posts: 2,792
    edited 2014-03-25 17:56
    I still find myself trying to write really compact PASM code even though I don't have the 512 long limit anymore. Is that a bad thing?
  • cgraceycgracey Posts: 14,134
    edited 2014-03-25 18:00
    Personally, I find the cog size limits being gone exhilirating.

    I know I will be able to do a lot more - and a lot more interesting things - because of hubexec.

    LMM was great on the P1, it allowed porting C ... but it also had a huge performance hit. That performance hit is basically history.

    Now we will need great docs, but frankly, it will be a lot easier to explain hubexec to people, than the limitations of having to fit into a cog.

    No need to answer the "HUH? You have 256KB of ram, but you can only write <2KB programs????"


    I agree, in a sense. So much more room just makes me have to think longer about what to do, whereas if we had an instruction area of only, say, 128 instructions, I would have all kinds of things I'd want to try to fit.

    You know what's kind of boring to imagine? Imagine a processor with an infinite memory space and only a few simple instructions - ones that would lend themselves to compilers. That just doesn't seem interesting to me, as it's flavorless and infinite. Not until you built some libraries to do interesting things would it start to get interesting. The Prop2 is designed to be engaging to a human at the assembly-language level.
  • jmgjmg Posts: 15,161
    edited 2014-03-25 18:07
    Space is still limited 256k bytes is only 32k opcodes (and that assuming no data )
    32k opcodes & 32k data

    Given recent threads, the Hub Execution may need to introduce the idea of memory-typing, so that the assembler can check ORG and references etc, really are where the user expected.
    Jellybean equates may not be enough anymore.
    Such memory-typing also helps symbolic debug, and watch handling.
  • cgraceycgracey Posts: 14,134
    edited 2014-03-25 18:13
    ozpropdev wrote: »
    I still find myself trying to write really compact PASM code even though I don't have the 512 long limit anymore. Is that a bad thing?


    The thing about all of us here is that we really enjoy and savor IMPLEMENTATION DETAILS. Modern engineering thinking seems to eschew this whole area of discipline, in favor of generic solutions that hide implementation. Implementation is almost a dirty word. There's no ingenuity in avoiding implementation matters, it seems to me..
  • cgraceycgracey Posts: 14,134
    edited 2014-03-25 18:15
    jmg wrote: »
    Space is still limited 256k bytes is only 32k opcodes (and that assuming no data )

    Given recent threads, the Hub Execution may need to introduce the idea of memory-typing, so that the assembler can check ORG and references etc, really are where the user expected.
    Jellybean equates may not be enough anymore.
    Such memory-typing also helps symbolic debug, and watch handling.


    256KB means 64K long opcodes, with no data.
  • jmgjmg Posts: 15,161
    edited 2014-03-25 18:30
    cgracey wrote: »
    256KB means 64K long opcodes, with no data.

    Doh - that's what happens when fingers are faster than a distracted brain.... fixed above.
  • Bill HenningBill Henning Posts: 6,445
    edited 2014-03-25 18:34
    cgracey wrote: »
    I agree, in a sense. So much more room just makes me have to think longer about what to do, whereas if we had an instruction area of only, say, 128 instructions, I would have all kinds of things I'd want to try to fit.

    Hmm... setmap the memory into four 128 long chunks, and you effectively have four baby cogs in a cog :)

    Actually I love the opportunities tasks, hubexec, and dare I say it, even threads open up.

    Many classes of applications that were impractical on P1 (ie more vision processing etc) become feasible on the P2.

    And if your application/driver fits.. there is still a certain elegance to fitting in a cog.
    cgracey wrote: »
    You know what's kind of boring to imagine? Imagine a processor with an infinite memory space and only a few simple instructions - ones that would lend themselves to compilers. That just doesn't seem interesting to me, as it's flavorless and infinite. Not until you built some libraries to do interesting things would it start to get interesting.

    Architectures that pander only to compilers are BORING.

    So we are in total agreement here :)

    Personally, I don't care if compilers don't use even 80% of those assembly language oriented instructions. Even if they could, it would not be economical to analyze for every possible special case.

    But so what?

    Assembly language programmers will use them all - when appropriate.
    cgracey wrote: »
    The Prop2 is designed to be engaging to a human at the assembly-language level.

    Exactly!

    And no compiler generated code will be able to touch code hand crafted by assembly experts that uses all the features & tricks.
  • Bill HenningBill Henning Posts: 6,445
    edited 2014-03-25 18:36
    Efficiency is almost a dirty word in computer science - the assumption is that computers will keep getting faster, so ease of readability, and at a lower level, ease of generating code by compilers, is worth more than efficiency or performance. After all, the thought goes, tomorrows computers will be faster!
    cgracey wrote: »
    The thing about all of us here is that we really enjoy and savor IMPLEMENTATION DETAILS. Modern engineering thinking seems to eschew this whole area of discipline, in favor of generic solutions that hide implementation. Implementation is almost a dirty word. There's no ingenuity in avoiding implementation matters, it seems to me..
  • jmgjmg Posts: 15,161
    edited 2014-03-25 18:39
    ozpropdev wrote: »
    I still find myself trying to write really compact PASM code even though I don't have the 512 long limit anymore. Is that a bad thing?

    Given Assembler is going to be important on a P2 for the lowest level crafting, I have always liked the look of HLA
    (Assembler control, without the tedium)

    http://en.wikipedia.org/wiki/High_Level_Assembly
    and a quick example
    http://www.plantation-productions.com/Webster/HighLevelAsm/hla_examples/calc2.hla.txt
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2014-03-25 18:50
    And after creating humans and everything else, God saw that it was good. So, on the seventh day (just prior to SERDESDay), God decided to take a rest. But then God got to thinking: "These humans Me, Myself and I have created are going to be MUCH more flexible or open-ended than the other creatures. Given enough time, it wouldn't be surprising if they figure out ways to swim through the seas and fly across the skies just like the fish and the birds. Is this really a good thing? Where will the challenge be of getting around on two legs? Oh, well, Let's just go with it and see what happens." --with apologies to Genesis
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-03-25 19:19
    Chip & All,

    First an example...
    We all know the 486 has lots of instructions.
    Do the compilers use all these? Probably not!
    How many write assembler for the 486? Probably not a lot!
    We all know Chip writes in assembler for the 486+.
    I wrote an emulation for the ICL mini I worked on - I used 486 Assembler and I targeted the new RISC (fast) instructions.

    So, to answer your original question Chip, it will not detract from what we want to do in P2 assembler, it will just enhance it!

    Now, we do have a problem looming. It has been touched on in different threads.
    We need to be able to get at both the hub address, and the cog address, for various instructions. We did strike this in the P1 and @@@ was introduced. But it is already an issue now with hubexec mode as well as cog mode. We now have relative and absolute addresses, but these need to be both for hub and cog modes.

    This is a sw issue, but one which needs to be addressed. I don't have any proposals yet - it is early days. But we are going to have mixed mode programs, just like the monitor program.

    Yesterday I spent some time looking at the monitor (including compiling it - thanks for posting the source Chip) to see what I could use of the monitor rom in hub. I thought I could use the tx_string but then I realised it had to call a cog routine to get each character. I used the hub strings successfully though. Certainly interesting times ahead ;)
  • potatoheadpotatohead Posts: 10,261
    edited 2014-03-25 19:28
    Chip, I totally grok where you are at. Maximizing something small and your choices are often that much more clever because of the limits.

    One thing to keep in mind is the new limits are still small for different sorts of tasks. Think doing an HDTV screen. That cramps the hub just as much as a simple VGA screen did P1.

    Right now things seem big, but they won't be once we start actually doing stuff. Soon, we will need tasks to maximize COGS, soon we will need HUBEX to maximize memory, or swap in code or work around data, soon we will need to communicate across the PORTD to make effective use of math and DACS and counters.

    The scope of challenging tasks doesn't need to get much bigger to start to squeeze, and data already will be that way. As usual, the video, audio and I/O capabilities far exceed the HUB RAM.

    We have opened it up, but it is by no means open ended, IMHO of course.
  • kwinnkwinn Posts: 8,697
    edited 2014-03-25 19:32
    ozpropdev wrote: »
    I still find myself trying to write really compact PASM code even though I don't have the 512 long limit anymore. Is that a bad thing?

    No, it's a good thing. Not only does it save memory, it will often run faster as well. Leaves more memory and cpu power for other things. Waste not, want not.
  • rjo__rjo__ Posts: 2,114
    edited 2014-03-25 19:43
    Chip,

    I have been trying to follow the development, but honestly after all of the contributions and conversations, I don't really understand the limits or limitlessness of Hub Execution.
    I like the concept of easy access to HUB RAM and expanded code space. It should actually make coding the kinds of things I am interested in far simpler, but as to whether this capability belongs in all of the Cogs or just a single Cog is beyond me. And (correct me if I am wrong) it seems that the performance boost is well worth the overhead.

    I still don't have the skill to take a video driver and make it work from multitasking or take a driver that has been written for multitasking and make it single tasked.
    BUT I think the video driver example is the exception rather than the rule. I suspect that most of the time, an object will simply have to be tagged as to whether it works under multitasking or requires HUB EXEC.

    At this point I would be very concerned about how all of this is ever going to be made tangible to the wider audience, but I have full confidence that Parallax's
    World class team of technical writers is more than up to the task.

    I like the idea of not having to use any of the advanced features, if I don't want to. As long as this remains largely the case, I don't think you should
    be concerned. AND I certainly don't think you should try to explain all of this yourself! Brief and to the point… if some of us don't quite get "it," that is not your problem.

    Thank you.

    Rich
  • RamonRamon Posts: 484
    edited 2014-03-25 19:44
    cgracey wrote: »
    The thing about all of us here is that we really enjoy and savor IMPLEMENTATION DETAILS. Modern engineering thinking seems to eschew this whole area of discipline, in favor of generic solutions that hide implementation. Implementation is almost a dirty word. There's no ingenuity in avoiding implementation matters, it seems to me..

    There is a lot of MONEY involved in keeping the implementation HIDDEN. The whole semiconductor industry is now the ART OF HIDING.

    Ofuscated RTL, intellectual property, layers and layers and layers of complexity to make main memory (DDR,NAND FLASH), mass storage (SATA), and protocols (USB, etc ...) away from people to be used, and only in the hands of a small group of industry associated leaders.

    The few books that gets their hands dirty into implementation are keep as gold. And is not easy to find implementation even in the university or academic circles because they are also following the same hidden practices.

    If some protocol get reverse engineered and used everywhere: replace it immmediatly with a new great, fantastic, bright ... but with an exponentially more complex to implement state machine in order to be controlled only by authorized hands.

    If some company makes a product that bites a big industry: buy it, or destroy it (legally, with our law).

    Engineering is not in the hands of engineers, but in the hands of business groups (and some business in the hands of governments too). Parallax seems to be the exception. And this is what I am here.
  • TubularTubular Posts: 4,655
    edited 2014-03-25 20:25
    From my situation, with a DE0 cog that is very full and running 4 tasks, hub ex is a Godsend. "Help me hub-ex kenobi, you're my onlybest hope"

    I think a lot of existing users value the propeller for its open ended approach - being free to put peripherals on any pin, use the cogs co-operatively or independently etc. The P2 is even more of a 'wide open road', and should be celebrated and marketed as such.

    I wouldn't worry about hubex as much of a source of disengagement. Here are a few reasons
    - code written to fit a tight constraint often isn't as easy to follow
    - hub ex allows us to consider porting big slabs from alternative code bases, more easily. I'm now tempted to port across some algorithms currently performed in an upstream PC that I wouldn't consider tackling previously
    - in many ways the hub execution is a more natural way for non P1 users to approach multicore processing. We existing P1 users need to step back a bit to appreciate this
    - limits are arbitrary. Is the (initially expansive) 512 long per cog / 32 kB hub limit of the P8x32A discouraging from engagement / solving problems? Not really...
    - there is nothing worse than not being able to access enough RAM when you need it (data, but code too).
    - the cog hasn't grown at 512 longs, but we now have 4 tasks. It'll be easier to fill a cog.
    - Hub ex is an elegant growth option once you fill a cog the old fashioned way.

    The possible downside to hub ex that I see may be to fracture the way people code share code destined for the obex. I don't know whether that is a real problem or not. And complicating the addressing slightly, perhaps. I'm about to find out for sure.

    On the other hand there are many things that can be done to encourage engagement. The new range of instructions and peripherals go a long way

    There's a bit of "choice paradox" or perhaps aesop's "fox and cat" in all this. I'm very pleased you consider this kind of thing, Chip.
  • RossHRossH Posts: 5,436
    edited 2014-03-25 20:47
    cgracey wrote: »
    You know what's kind of boring to imagine? Imagine a processor with an infinite memory space and only a few simple instructions - ones that would lend themselves to compilers. That just doesn't seem interesting to me, as it's flavorless and infinite. Not until you built some libraries to do interesting things would it start to get interesting. The Prop2 is designed to be engaging to a human at the assembly-language level.

    But most people do not engage with computers at the assembly language level. I guess we tend to forget that because we spend so much time at that level in forums like this - but we we are the exception, not the rule! :smile:

    Many (perhaps even most) P2 programmers will use a higher level language - SPIN, C or C++ (or FORTH or LISP or JAVA). For them, the P2 will be just another microprocessor (via HUB execution mode) that also has a quirky additional microcode-like facility (COG execution mode) that gurus can use to write hardware interfaces or device drivers.

    Ross.
  • RossHRossH Posts: 5,436
    edited 2014-03-25 20:47
    Cluso99 wrote: »
    Chip & All,

    ...

    Now, we do have a problem looming. It has been touched on in different threads.
    We need to be able to get at both the hub address, and the cog address, for various instructions. We did strike this in the P1 and @@@ was introduced. But it is already an issue now with hubexec mode as well as cog mode. We now have relative and absolute addresses, but these need to be both for hub and cog modes.

    This is a sw issue, but one which needs to be addressed. I don't have any proposals yet - it is early days. But we are going to have mixed mode programs, just like the monitor program.
    ...

    I posted a proposal on this in the "Blog" thread - here. The response so far has been underwhelming. I think most people don't yet get that this is going to be an issue, or that what I proposed is supposed to get rid of the need for @, @@ or @@@.

    Ross.
  • roglohrogloh Posts: 5,522
    edited 2014-03-25 20:52
    Don't worry Chip, I think once we start using P2 for applications which require deterministic I/O at higher speeds than the applications we are all familiar with on P1 (I'd expect some of those can probably now be catered for with hubexec including a lot of video stuff), it will all get interesting and constrained again. We will then be forced to again become very creative in how we use the COG resources there and start solving the mental jigsaw puzzles with native COG PASM and all its rich set of cool features you've given us. For example I imagine doing a software Ethernet MAC talking to a 100Mbps PHY using RMII or MII at 50/25MHz will be a good one, QuadSPI for sure and maybe even 8b10b DVI/TMDS are others. We just need to move up our expectations of what this device might now do and it will get nice and tricky and interesting for those inclined. Highest performing 2kB limited PASM will no doubt still be used and remain fun.

    Roger.

    Update: So my gut feeling tells me applications requiring hitting I/O speeds and processing data probably in the ballpark of several tens of Mbps will become the more challenging ones for P2 to solve depending on what extra HW capabilities we may get with any future "SerDes" feature added to P2. The Hubexec model may not necessarily always be able to cater for these data rates given the extra hub access cycles it may require to execute. It will primarily depend on how real-time hubexec can be kept using its instruction cache and how exactly the time critical I/O loops are able to be fashioned.
  • Roy ElthamRoy Eltham Posts: 3,000
    edited 2014-03-25 21:18
    Chip,
    Hold on! The P2 is still TINY in comparison pretty much anything with it's level of power/ability. Working with it to take full advantage of it's ability is going to be a real challenge for us all. I think you just aren't thinking big enough in what you think it can do? Imagine some of your real time visualization dreams, some of those are going to need big data and big code.

    Also, as a comparison, my day job involves dealing with hundreds of textures all of which are too big to fit in the P2 memory (some are 5.5MB in compressed form (22MB if it were RGBA 32bit form)), combined with a multitude of other pieces of data like sound, meshes, collision information, and so on (many of which individually are again too big to fit in the P2). I've been spending most of my time lately making our stuff more efficient, so we don't run out of address space on a 32bit Windows environment (which is 2GB). It's all just a matter of scale. When you are trying to render sufficiently detailed graphics and sound on modern machines at high resolution, you just need a lot more memory.

    Trying to display sufficient detail at even 720p (let alone 1080p) can consume considerable space not just for the data, but for the code needed to manage, process, and display the data.
  • jmgjmg Posts: 15,161
    edited 2014-03-25 21:45
    RossH wrote: »
    I think most people don't yet get that this is going to be an issue, or that what I proposed is supposed to get rid of the need for @, @@ or @@@.

    Anything that help make Assembler source faster to visually scan, and helps the tools do the housekeeping, is a good idea.
    Getting rid of syntax strangeness like @, @@ or @@@ is a step in the right direction.
  • cgraceycgracey Posts: 14,134
    edited 2014-03-25 21:48
    Ramon wrote: »
    There is a lot of MONEY involved in keeping the implementation HIDDEN. The whole semiconductor industry is now the ART OF HIDING.

    Ofuscated RTL, intellectual property, layers and layers and layers of complexity to make main memory (DDR,NAND FLASH), mass storage (SATA), and protocols (USB, etc ...) away from people to be used, and only in the hands of a small group of industry associated leaders.

    The few books that gets their hands dirty into implementation are keep as gold. And is not easy to find implementation even in the university or academic circles because they are also following the same hidden practices.

    If some protocol get reverse engineered and used everywhere: replace it immmediatly with a new great, fantastic, bright ... but with an exponentially more complex to implement state machine in order to be controlled only by authorized hands.

    If some company makes a product that bites a big industry: buy it, or destroy it (legally, with our law).

    Engineering is not in the hands of engineers, but in the hands of business groups (and some business in the hands of governments too). Parallax seems to be the exception. And this is what I am here.


    You articulated here a lot of things that affect my motivation. I miss the days when disparate protocols could be addressed through flexibility, alone. Now, not only is dedicated transistor-level hardware often required (for unavoidable reasons), but there's the patronage to be paid to the standards owners who keep their protocol details hidden. Not fun. Not the future I had hoped for. It's like the expanding wavefront squirreled off into another dimension that is unreachable, or at least unpalatable. Only the desire for money and the willingness to forfeit freedom can take one there.

    There's still much that can be developed with simple circuits in pins to deal with voltages, currents, resistances, and capacitive/inductive reactances, in order to realize novel sensors and control loops. The natural world is still our friend, and always will be. I would be content to just live there, myself.

    When I first learned about computers, I had this notion that they would evolve to be benevolent helpers that would be, first of all, reliable and loyal. It's turned out that they are primarily conduits for a lot of sludge, with a whole bunch of diseases and treachery coursing through them. Definitely NOT our friends, anymore.
  • jazzedjazzed Posts: 11,803
    edited 2014-03-25 22:32
    cgracey wrote: »
    It's been creeping up on me that perhaps hub exec makes things so open-ended, that it actually is slowing people's engagement down, because they are not dealing with a limited space, anymore, and anything is possible. Would you all concur?
    Sorry Chip, but I think that idea is silly.

    I want the power to achieve the goals of my product. The last thing I want is to wonder about how quickly I'll exhaust code space before finishing something. I built a G-Code interpreter and XY table driver in SPIN once. It was complete except for a few very important details. Code space was gone. Sorry, but I'm not into programming just to don a straight-jacket.
  • potatoheadpotatohead Posts: 10,261
    edited 2014-03-25 22:37
    And I share those motivations. I think a fair number of us at least entertain them.

    Making tech accessible is always worth doing Chip. That's why I'm here. Picked up on it right away. Not hard to see when Parallax works hard to be as good of humans as they are competent technically.

    We are going to hit a coupla hundred Mhz, multi-core, multi-task. That's a lot! Sure, the overall chip is small relative to many things people do, but it won't always be. Get near a Ghz, and suddenly it's possible to just go and do your own thing.

    I think that's going to happen to some degree with open hardware movements out there gaining steam. We've got open other kinds of movements running well, and those are directly competing with closed stuff.

    Personally, I think we are doing good things. Thanks for it. Not sure where the journey will take us all, but it sure is a fun ride!

    One other thing. Big money tends to get kind of needy and heavy. Usually, the result is a lot of the value ends up taken out in terms of layers of cost. Whatever we all think about it isn't so important. People needing to do their own thing is growing more important, not less.
  • potatoheadpotatohead Posts: 10,261
    edited 2014-03-25 22:38
    BTW Chip, a demoscene type culture around the P2 would very quickly erase the perception that it's too much. Just saying... and kind of hoping it happens.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-03-26 00:14
    RossH wrote: »
    I posted a proposal on this in the "Blog" thread - here. The response so far has been underwhelming. I think most people don't yet get that this is going to be an issue, or that what I proposed is supposed to get rid of the need for @, @@ or @@@.

    Ross.
    Yes, I did see your comments, and the underwhelming response. At least we missed the naysayers this time round!

    Perhaps there will be more enthusiasm when we start to produce drivers - guess we will see ;)
  • BaggersBaggers Posts: 3,019
    edited 2014-03-26 01:01
    Chip, I agree with you on it being a lot easier to throw big code at it now, simple because you can, so for some there won't be that buzz of getting something amazing fitting into a single cog space of code.

    However, what you also need to do with this chip, is make it usable for the masses, who aren't as hard core as all us prop heads are, and removing 2K code+vars limits will help them get over this hurdle, again with the C stuff that's being done, that should help bring in new customers too, and hopefully help make the P2 the success story that it clearly is to us all already!
Sign In or Register to comment.